Skip to main content
Version: Next

abstractAbstractSqlConnection

Hierarchy

Index

Constructors

constructor

Methods

begin

checkConnection

  • checkConnection(): Promise<{ ok: true } | { error?: Error; ok: false; reason: string }>
  • Are we connected to the database


    Returns Promise<{ ok: true } | { error?: Error; ok: false; reason: string }>

close

  • close(force?: boolean): Promise<void>
  • Closes the database connection (aka disconnect)


    Parameters

    • optionalforce: boolean

    Returns Promise<void>

commit

  • Parameters

    Returns Promise<void>

connect

  • connect(): void | Promise<void>
  • Establishes connection to database


    Returns void | Promise<void>

abstractcreateKnex

  • createKnex(): void
  • Returns void

inheritedensureConnection

  • ensureConnection(): Promise<void>
  • Ensure the connection exists, this is used to support lazy connect when using MikroORM.initSync()


    Returns Promise<void>

execute

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

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

    Returns Promise<T>

inheritedgetClientUrl

  • getClientUrl(): string
  • Returns string

inheritedgetConnectionOptions

abstractinheritedgetDefaultClientUrl

  • getDefaultClientUrl(): string
  • Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)


    Returns string

getKnex

  • getKnex(): Knex<any, any[]>
  • Returns Knex<any, any[]>

inheritedgetPlatform

  • Returns Platform

isConnected

  • isConnected(): Promise<boolean>
  • Are we connected to the database


    Returns Promise<boolean>

loadFile

  • loadFile(path: string): Promise<void>
  • Execute raw SQL queries from file


    Parameters

    • path: string

    Returns Promise<void>

rollback

  • Parameters

    Returns Promise<void>

inheritedsetMetadata

  • Parameters

    Returns void

inheritedsetPlatform

  • Parameters

    Returns void

transactional

  • transactional(cb: (trx: Transaction<any, any[]>) => Promise<T>, options?: { ctx?: Transaction<any, any[]>; eventBroadcaster?: TransactionEventBroadcaster; isolationLevel?: IsolationLevel; readOnly?: boolean }): Promise<T>
  • Parameters

    Returns Promise<T>