Extends
Members
(static) dependencies :Array.<string>
Class dependencies:
['app', 'connection', 'db.resolver', 'file', 'helper.string']
.
stringHelper :support.helpers.StringHelper
String helper instance.
engine :*
- Source:
- Inherited From:
Current engine accessor.
Methods
(abstract) buildEngine(connection)
Build an engine with given connection.
Parameters:
Name | Type | Description |
---|---|---|
connection |
Knex | The Knex connection instance. |
Returns:
The ORM engine.
- Type
- *
withConnection(connection)
Get ORM driver with given connection.
Parameters:
Name | Type | Description |
---|---|---|
connection |
Knex | The Knex connection instance. |
Returns:
The current driver instance.
model(name, Modelopt)
Get and/or set model.
If name and model are provided, the model is registered as name in the engine.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The model name. | |
Model |
database.Model |
<optional> |
The model class. |
Returns:
Model instance.
- Type
- database.Model
getModel(name)
Get model by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The model name. |
Returns:
The model instance, or null if it was not found.
- Type
- database.Model | null
setModel(name, model)
Set model with given name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The model name. |
model |
database.Model | The model instance. |
resolveModel(name)
Resolve model instance by name from the models path in the database resolver.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The model name. |
Returns:
A model instance.
- Type
- database.Model | null
buildModel(model)
Build model.
Parameters:
Name | Type | Description |
---|---|---|
model |
database.Model | The model instance. |
Returns:
The built model instance.
- Type
- database.Model
getFormattedModelClassName(name)
Get formatted model class name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The model name. |
Returns:
The formatted model name.
- Type
- string
setEngine(engine)
- Source:
- Inherited From:
Set current engine.
Parameters:
Name | Type | Description |
---|---|---|
engine |
* | The engine instance. |
Returns:
The current instance.