@absolunet/ioc2.1.0

View on GitHub

Driver

Abstract ORM driver.

Extends

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'connection', 'db.resolver', 'file', 'helper.string'].

stringHelper :support.helpers.StringHelper

Source:
String helper instance.

engine :*

Source:
Inherited From:
Current engine accessor.

Methods

(abstract) buildEngine(connection)

Source:
Build an engine with given connection.
Parameters:
Name Type Description
connection Knex The Knex connection instance.
Returns:
The ORM engine.
Type
*

withConnection(connection)

Source:
Get ORM driver with given connection.
Parameters:
Name Type Description
connection Knex The Knex connection instance.
Returns:
The current driver instance.
Type
translation.services.Translator.drivers.Driver

model(name, Modelopt)

Source:
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)

Source:
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)

Source:
Set model with given name.
Parameters:
Name Type Description
name string The model name.
model database.Model The model instance.

resolveModel(name)

Source:
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)

Source:
Build model.
Parameters:
Name Type Description
model database.Model The model instance.
Returns:
The built model instance.
Type
database.Model

getFormattedModelClassName(name)

Source:
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.
Type
support.mixins.HasEngine