MariaDbConnection
Hierarchy
- AbstractSqlConnection
- MariaDbConnection
Index
Constructors
constructor
Parameters
config: Configuration<IDatabaseDriver<Connection>>
optionaloptions: ConnectionOptions
optionaltype: read | write
Returns MariaDbConnection
Methods
begin
Parameters
options: { ctx?: Transaction<any, any[]>; eventBroadcaster?: TransactionEventBroadcaster; isolationLevel?: IsolationLevel; readOnly?: boolean } = {}
optionalctx: Transaction<any, any[]>
optionaleventBroadcaster: TransactionEventBroadcaster
optionalisolationLevel: IsolationLevel
optionalreadOnly: boolean
Returns Promise<Transaction<any, any[]>>
close
Parameters
optionalforce: boolean
Returns Promise<void>
commit
Parameters
ctx: Transaction<any, any[]>
optionaleventBroadcaster: TransactionEventBroadcaster
Returns Promise<void>
connect
Establishes connection to database
Returns Promise<void>
execute
Type parameters
- T: QueryResult<{ id: number }> | EntityData<Partial<any>> | EntityData<Partial<any>>[] = EntityData<Partial<any>>[]
Parameters
queryOrKnex: string | Raw<any> | QueryBuilder<any, any>
params: unknown[] = []
method: get | all | run = 'all'
optionalctx: any
Returns Promise<T>
getClientUrl
Returns string
getConnectionOptions
Returns MySqlConnectionConfig
getDefaultClientUrl
Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)
Returns string
getKnex
Returns Knex<any, any[]>
getPlatform
Returns Platform
isConnected
Are we connected to the database
Returns Promise<boolean>
loadFile
Execute raw SQL queries from file
Parameters
path: string
Returns Promise<void>
rollback
Parameters
ctx: Transaction<any, any[]>
optionaleventBroadcaster: TransactionEventBroadcaster
Returns Promise<void>
setMetadata
Parameters
metadata: MetadataStorage
Returns void
setPlatform
Parameters
platform: Platform
Returns void
transactional
Type parameters
- T
Parameters
cb: (trx: Transaction<any, any[]>) => Promise<T>
options: { ctx?: Transaction<any, any[]>; eventBroadcaster?: TransactionEventBroadcaster; isolationLevel?: IsolationLevel; readOnly?: boolean } = {}
optionalctx: Transaction<any, any[]>
optionaleventBroadcaster: TransactionEventBroadcaster
optionalisolationLevel: IsolationLevel
optionalreadOnly: boolean
Returns Promise<T>
Closes the database connection (aka disconnect)