@absolunet/ioc2.1.0

View on GitHub

ORM

ORM to interact with the database with an Active Record Pattern (ARP).

Extends

Members

(static) dependencies :Array.<string>

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

stringHelper :support.helpers.StringHelper

Source:
String helper.

Methods

registerModel(name, Model)

Source:
Register model. If a single argument is provided, the model class name will be used as identifier.
Parameters:
Name Type Description
name string The model name.
Model database.Model The model class.

getModel(name)

Source:
Retrieve model by name.
Parameters:
Name Type Description
name string The model name.
Returns:
The model instance.
Type
database.Model

getFormattedModelName(name)

Source:
Get formatted model name.
Parameters:
Name Type Description
name string The model name.
Returns:
The formatted model name.
Type
string

engine(driver)

Source:
Get underlying ORM engine.
Parameters:
Name Type Description
driver string The driver name to get engine from.
Returns:
The underlying engine.
Type
*

driver(nameopt, parametersopt)

Source:
Inherited From:
Get loader driver by name.
Parameters:
Name Type Attributes Default Description
name string <optional>
"default" The driver name.
parameters object <optional>
{} The additional parameters to inject into the driver instance.
Returns:
The resolved driver instance.
Type
object

bootDriver(driver, name)

Source:
Inherited From:
Boot newly created driver.
Parameters:
Name Type Description
driver * The driver instance.
name string The driver name.
Returns:
The driver instance.
Type
*

addDriver(name, driver)

Source:
Overrides:
Add a driver and bind it with the given name.
Parameters:
Name Type Description
name string The driver name.
driver function The driver class or factory.

setDefaultDriver(name)

Source:
Inherited From:
Set given driver name as the default driver.
Parameters:
Name Type Description
name string The driver name.

setDriverAlias(name, alias)

Source:
Inherited From:
Give driver an alias name.
Parameters:
Name Type Description
name string The driver name.
alias string The driver alias.

hasDriver(name)

Source:
Inherited From:
Check if driver exists.
Parameters:
Name Type Description
name string The driver name.
Returns:
Indicates that the driver exists.
Type
boolean

isDriverAlias(name)

Source:
Inherited From:
Check if given driver name is an alias.
Parameters:
Name Type Description
name string The driver alias name.
Returns:
Indicates that the alias exists.
Type
boolean