Initialize the DataContext.
Begin a transaction.
Connection type for the underlying database driver.
Pool type for the underlying database driver.
transFunc shall be resolved with type R, and this function will proxy the return when transFunc completes.
A user-supplied function that will be called with a DataContext instance. All queries executed against the DataContext will be part of the transaction. The user-supplied function should return a promise. If that promise is resolved then the transaction will be committed, otherwise it will be rolled back. The return of transFunc is returned from beginTransaction.
A promise that will be rejected if there is an error when beginning the transaction.
Connect to the database.
Connection options for setting up a connection to the database.
A promise that will be resolved with this DataContext instance.
Create a new DeleteModel instance that can be used to delete a model by ID. For complex delete operations, use the DataContext.from method to obtain a FromAdapter instance, and then call FromAdapter.delete on that instance.
The type of model to delete, which is the constructor of a Table-decorated class.
An Entity instance to delete, which must have the primary key set.
A DeleteModel instance that can be executed using DeleteModel.execute.
End the connection pool.
Create a new FromAdapter instance, which can then be used to select, update, or delete.
A Table-decorated entity which is the constructor of the FROM table.
Alias for the FROM table, used in conditions, joins, and column selection. Optional: defaults to the name of the table.
A FromAdapter that implements FromAdapter.select, FromAdapter.update, and FromAdapter.delete.
Get an Escaper instance for the database (e.g. MySQLEscaper).
Get an Executer instance for the database (e.g. MySQLExecuter).
Create and return a new Insert instance.
The type of model to insert, which is the constructor of a Table-decorated class.
An Entity instance to insert.
An Insert instance that can be executed using Insert.execute.
Rollback a transaction. This method is only implemented in concrete DataContexts that are tied to a transaction. For example, MySQLTransactionalDataContext.
Create a new UpdateModel instance that can be used to update a model by ID. For complex update operations, use the DataContext.from method to obtain a FromAdapter instance, and then call FromAdapter.update on that instance.
The type of model to update, which is the constructor of a Table-decorated class.
An Entity instance to update, which must have the primary key set.
An UpdateModel instance that can be executed using UpdateModel.execute.
Generated using TypeDoc
This is the main interface to the ORM. It provides access to CRUD operations and connection management.