These are the 4 main reasons that motivated this project at Blitz
Blitz ORM is an ORM Object-Relational mapping for (mainly) graph databases. Blitz acts as an interface between your logic and the database to abstract their differences.
It also adds lots of layers to the databases, like auth management, data validation, pre-insertion data transformation and post-insertion data transformation.
BlitzQL is a query language, similar to graphQL but in JSON format with some enhancements. BQL is the language that Borm understands for retrieving, updating, modifying or deleting data in your databases.
type Author {
id: ID;
name: String;
rank: Number;
writtenBooks: [Book];
}
type Reviewer {
id: ID;
name: String;
revisedBooks: [Book];
}
type Book {
id: ID;
title: String;
writtenBy: [Author] @hasInverse(field: 'writtenBooks');
reviewedBy: [Reviewer] @hasInverse(field: 'revisedBooks');
chapters: [Chapters] @hasInverse(field: 'inBook')
}
type Chapters @rules([deleteOnParentDeletion]) {
id: ID;
name: String;
inBook: Book; @parent
description: String
}
The field name is used in multiple types, so it’s a shared field
const name = {
shared: true,
dbConnector: {id:'db1', path:'name'}, // if not specified, uses the one configured at the entity level
cardinality: 'one',
// as this field is a shared one, the uniqueness is also "shared" (not even for two different types the id can be the same)
contentType: 'text',
validations: { required: true },
}
const id = {
shared: true,
dbConnector: {id:'db1', path:'id'},
cardinality: 'one',
// as this field is a shared one, the uniqueness is also "shared" (not even for two different types the id can be the same)
default: { type: 'function', value: () => uuidv4() },
contentType: 'uuid',
validations: { required: true, unique: true },
}