@absolunet/ioc2.1.0

View on GitHub

MySQLDriver

MySQL connector driver.

Extends

Members

client :string

Source:
Overrides:
Client to be used, such as "mysql", "sqlite3", etc.

migrationsTable :string

Source:
Inherited From:
The migration table name.

Methods

getConnection(nameopt)

Source:
Inherited From:
Get Knex connection.
Parameters:
Name Type Attributes Default Description
name string <optional>
"default" The connection name.
Returns:
A Knex connection instance.
Type
Knex

getDefaultConnection()

Source:
Inherited From:
Get default Knex connection.
Returns:
A Knex connection instance.
Type
Knex

setConnection(name, connection)

Source:
Inherited From:
Set Knex connection with name.
Parameters:
Name Type Description
name string The connection name.
connection Knex The Knex connection instance.
Returns:
The current driver instance.
Type
translation.services.Translator.drivers.Driver

setDefaultConnection(connection)

Source:
Inherited From:
Set default Knex connection instance.
Parameters:
Name Type Description
connection Knex The Knex connection instance.
Returns:
The current driver instance.
Type
translation.services.Translator.drivers.Driver

hasConnection(name)

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

getOrCreateConnection(name, config)

Source:
Inherited From:
Get connection if it exists, otherwise create a new connection and returns it.
Parameters:
Name Type Description
name string The connection name.
config object The connection configuration.
Returns:
A Knex connection instance.
Type
Knex

createConnection(name, config)

Source:
Inherited From:
Create new connection and store it by name.
Parameters:
Name Type Description
name string The connection name.
config object The connection configuration.
Returns:
A Knex connection instance.
Type
Knex

makeConnection(config)

Source:
Inherited From:
Make new Knex connection.
Parameters:
Name Type Description
config object The connection configuration.
Returns:
A Knex instance.
Type
Knex

mapConfig(config)

Source:
Inherited From:
Map configuration from the driver and given configuration into a Knex configuratioon model.
Parameters:
Name Type Description
config object The connection configuration.
Returns:
The full Knex connection configuration.
Type
object

(async) clean(connectionopt, optionsopt)

Source:
Inherited From:
See:
  • dropAll()
Clean the database of existing data. Keeps the tables.
Parameters:
Name Type Attributes Description
connection Knex <optional>
The Knex connection instance.
options object <optional>
The knex-clean options.
Returns:
The async process promise.
Type
Promise

(async) dropAll(connectionopt, optionsopt)

Source:
Inherited From:
Drop all tables from the database.
Parameters:
Name Type Attributes Description
connection Knex <optional>
The Knex connection instance.
options object <optional>
The knex-clean options.
Returns:
The async process promise.
Type
Promise

(async) migrationStatus(connection)

Source:
Inherited From:
Get migration status.
Parameters:
Name Type Description
connection Knex The Knex connection instance.
Returns:
The migration status.
Type
Promise.<Array.<{name: string, ran: boolean}>>