1.2.0
Base Model class which should be used as an extension for database entities.
.blacklistedProps
List of properties which shall not be present in database entities. The blacklist takes precedence over any whitelist rule.
List of properties which shall not be present in database entities. The blacklist takes precedence over any whitelist rule.
.idAttribute
.jsonSchema
JSON Schema to be used for validating instances of the Model. Validation happens automatically before executing queries.
JSON Schema to be used for validating instances of the Model. Validation happens automatically before executing queries.
.primaryKey
Primary key of the Model, used for instance identification.
Primary key of the Model, used for instance identification.
.query
Returns a new QueryBuilder instance which corresponds to the current Model.
Returns a new QueryBuilder instance which corresponds to the current Model.
QueryBuilder
.tableName
Case-sensitive name of the database table which corresponds to the Model.
Case-sensitive name of the database table which corresponds to the Model.
.whitelistedProps
List of properties which should exclusively be present in database entities. If the list is empty, then every enumerable property of the instance are considered to be database entities.
List of properties which should exclusively be present in database entities. If the list is empty, then every enumerable property of the instance are considered to be database entities.
#del
Queues the deletion of the current Model from the database.
Queues the deletion of the current Model from the database.
QueryBuilder
#fetchRelated(props)
Queues fetching the given related Models of the current instance.
Queues fetching the given related Models of the current instance.
Relation attributes to be fetched.
QueryBuilder
#save
Queues saving (creating or updating) the current Model in the database.
Queues saving (creating or updating) the current Model in the database.
QueryBuilder
#validate
Validates all the enumerable properties of the current instance.
Validates all the enumerable properties of the current instance.
Entry class for accessing the functionality of Knex-ORM.
Knex client corresponding to the ORM instance.
#constructor(knex, [options])
Creates a new Knex-ORM instance.
Creates a new Knex-ORM instance.
Knex client instance to which database functions shall be bound.
Additional options regarding ORM.
false
)
If set to true, then the ORM will handle letter case conversion for properties automatically (between camelCase and snake_case).
#Model
Base Model class corresponding to the current ORM instance.
Base Model class corresponding to the current ORM instance.
#register(model, [name])
Registers a static Model object to the list of database objects.
Registers a static Model object to the list of database objects.
Model to be registered.
Name under which the Model shall be registered.
Model
:
The Model which was registered.
Extends Error
An error which gets thrown when an attempt is made to register a database object multiple times.
Name of the database object in question.
Extends Error
An error which gets thrown when an attempt is made to store an empty database object.
Extends Error
An error which gets thrown when an attempt is made to modify an inexistent database object.
Represents a query builder which corresponds to a static Model reference. Inherits every query method of the Knex query builder.
#withRelated(props)
Queues fetching the given related Models of the queryable instance(s).
Queues fetching the given related Models of the queryable instance(s).
Relation attributes to be fetched.
QueryBuilder
Extends Error
An error which gets thrown when a Relation does not behave as expected.