Skip to main content
Version: 5.9

MariaDbDriver

Hierarchy

  • AbstractSqlDriver<MariaDbConnection, MariaDbPlatform>
    • MariaDbDriver

Index

Constructors

constructor

  • new MariaDbDriver(config: Configuration<IDatabaseDriver<Connection>>): MariaDbDriver
  • Parameters

    • config: Configuration<IDatabaseDriver<Connection>>

    Returns MariaDbDriver

Properties

[EntityManagerType]

[EntityManagerType]: SqlEntityManager<MariaDbDriver>

readonlyconfig

config: Configuration<IDatabaseDriver<Connection>>

Methods

aggregate

  • aggregate(entityName: string, pipeline: any[]): Promise<any[]>
  • Parameters

    • entityName: string
    • pipeline: any[]

    Returns Promise<any[]>

close

  • close(force?: boolean): Promise<void>
  • Parameters

    • optionalforce: boolean

    Returns Promise<void>

connect

  • connect(): Promise<MariaDbConnection>
  • Returns Promise<MariaDbConnection>

convertException

  • convertException(exception: Error): DriverException
  • Converts native db errors to standardized driver exceptions


    Parameters

    • exception: Error

    Returns DriverException

count

  • count<T>(entityName: string, where: any, options?: CountOptions<T, never>): Promise<number>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: any
    • options: CountOptions<T, never> = {}

    Returns Promise<number>

countVirtual

  • countVirtual<T>(entityName: string, where: FilterQuery<T>, options: CountOptions<T, any>): Promise<number>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • options: CountOptions<T, any>

    Returns Promise<number>

createEntityManager

  • createEntityManager<D>(useContext?: boolean): D[typeof EntityManagerType]
  • Type parameters

    • D: IDatabaseDriver<Connection, D> = IDatabaseDriver<Connection>

    Parameters

    • optionaluseContext: boolean

    Returns D[typeof EntityManagerType]

ensureIndexes

  • ensureIndexes(): Promise<void>
  • Returns Promise<void>

execute

  • execute<T>(queryOrKnex: string | Raw<any> | QueryBuilder<any, any>, params?: any[], method?: get | all | run, ctx?: any): Promise<T>
  • Type parameters

    • T: QueryResult<{ id: number }> | EntityData<Partial<any>> | EntityData<Partial<any>>[] = EntityData<Partial<any>>[]

    Parameters

    • queryOrKnex: string | Raw<any> | QueryBuilder<any, any>
    • params: any[] = []
    • method: get | all | run = 'all'
    • optionalctx: any

    Returns Promise<T>

find

  • find<T, P>(entityName: string, where: FilterQuery<T>, options?: FindOptions<T, P>): Promise<EntityData<T>[]>
  • Finds selection of entities


    Type parameters

    • T: object
    • P: string = never

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • options: FindOptions<T, P> = {}

    Returns Promise<EntityData<T>[]>

findOne

  • findOne<T, P>(entityName: string, where: FilterQuery<T>, options?: FindOneOptions<T, P>): Promise<null | EntityData<T>>
  • Finds single entity (table row, document)


    Type parameters

    • T: object
    • P: string = never

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • optionaloptions: FindOneOptions<T, P>

    Returns Promise<null | EntityData<T>>

findVirtual

  • findVirtual<T>(entityName: string, where: FilterQuery<T>, options: FindOptions<T, any>): Promise<EntityData<T>[]>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • options: FindOptions<T, any>

    Returns Promise<EntityData<T>[]>

getConnection

  • getConnection(type?: ConnectionType): MariaDbConnection
  • Parameters

    • type: ConnectionType = 'write'

    Returns MariaDbConnection

getDependencies

  • getDependencies(): string[]
  • Returns name of the underlying database dependencies (e.g. mongodb or mysql2) for SQL drivers it also returns knex in the array as connectors are not used directly there


    Returns string[]

getMetadata

  • getMetadata(): MetadataStorage
  • Returns MetadataStorage

getPlatform

  • getPlatform(): MariaDbPlatform
  • Returns MariaDbPlatform

init

  • init(): Promise<void>
  • Returns Promise<void>

loadFromPivotTable

  • loadFromPivotTable<T, O>(prop: EntityProperty<any>, owners: Primary<O>[][], where?: FilterQuery<any>, orderBy?: QueryOrderMap<T>[], ctx?: any, options?: FindOptions<T, any>): Promise<Dictionary<T[]>>
  • When driver uses pivot tables for M:N, this method will load identifiers for given collections from them


    Type parameters

    • T: object
    • O: object

    Parameters

    • prop: EntityProperty<any>
    • owners: Primary<O>[][]
    • where: FilterQuery<any> = ...
    • optionalorderBy: QueryOrderMap<T>[]
    • optionalctx: any
    • optionaloptions: FindOptions<T, any>

    Returns Promise<Dictionary<T[]>>

lockPessimistic

  • lockPessimistic<T>(entity: T, options: LockOptions): Promise<void>
  • Type parameters

    • T

    Parameters

    • entity: T
    • options: LockOptions

    Returns Promise<void>

mapResult

  • mapResult<T>(result: EntityData<T>, meta: EntityMetadata<T>, populate?: PopulateOptions<T>[], qb?: QueryBuilder<T>, map?: Dictionary): null | EntityData<T>
  • Type parameters

    • T: object

    Parameters

    • result: EntityData<T>
    • meta: EntityMetadata<T>
    • populate: PopulateOptions<T>[] = []
    • optionalqb: QueryBuilder<T>
    • map: Dictionary = {}

    Returns null | EntityData<T>

nativeDelete

  • nativeDelete<T>(entityName: string, where: any, options?: DeleteOptions<T>): Promise<QueryResult<T>>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: any
    • options: DeleteOptions<T> = {}

    Returns Promise<QueryResult<T>>

nativeInsert

  • nativeInsert<T>(entityName: string, data: EntityDictionary<T>, options?: NativeInsertUpdateOptions<T>): Promise<QueryResult<T>>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • data: EntityDictionary<T>
    • options: NativeInsertUpdateOptions<T> = {}

    Returns Promise<QueryResult<T>>

nativeInsertMany

  • nativeInsertMany<T>(entityName: string, data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>): Promise<QueryResult<T>>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • data: EntityDictionary<T>[]
    • options: NativeInsertUpdateManyOptions<T> = {}

    Returns Promise<QueryResult<T>>

nativeUpdate

  • nativeUpdate<T>(entityName: string, where: FilterQuery<T>, data: EntityDictionary<T>, options?: NativeInsertUpdateOptions<T> & UpsertOptions<T>): Promise<QueryResult<T>>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • data: EntityDictionary<T>
    • options: NativeInsertUpdateOptions<T> & UpsertOptions<T> = {}

    Returns Promise<QueryResult<T>>

nativeUpdateMany

  • nativeUpdateMany<T>(entityName: string, where: FilterQuery<T>[], data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T> & UpsertManyOptions<T>): Promise<QueryResult<T>>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: FilterQuery<T>[]
    • data: EntityDictionary<T>[]
    • options: NativeInsertUpdateManyOptions<T> & UpsertManyOptions<T> = {}

    Returns Promise<QueryResult<T>>

reconnect

  • reconnect(): Promise<MariaDbConnection>
  • Returns Promise<MariaDbConnection>

setMetadata

  • setMetadata(metadata: MetadataStorage): void
  • Parameters

    • metadata: MetadataStorage

    Returns void

syncCollection

  • syncCollection<T, O>(coll: Collection<T, O>, options?: DriverMethodOptions): Promise<void>
  • Type parameters

    • T: object
    • O: object

    Parameters

    • coll: Collection<T, O>
    • optionaloptions: DriverMethodOptions

    Returns Promise<void>