Skip to main content
Version: 6.4

MySqlConnection

Hierarchy

Index

Constructors

constructor

Methods

inheritedbegin

inheritedcheckConnection

  • 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 }>

inheritedclose

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


    Parameters

    • optionalforce: boolean

    Returns Promise<void>

inheritedcommit

  • Parameters

    Returns Promise<void>

inheritedconnect

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


    Returns void | Promise<void>

createKnex

  • 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>

inheritedexecute

  • 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

getConnectionOptions

  • getConnectionOptions(): MySqlConnectionConfig
  • Returns MySqlConnectionConfig

getDefaultClientUrl

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


    Returns string

inheritedgetKnex

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

inheritedgetPlatform

  • Returns Platform

inheritedisConnected

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


    Returns Promise<boolean>

inheritedloadFile

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


    Parameters

    • path: string

    Returns Promise<void>

inheritedrollback

  • Parameters

    Returns Promise<void>

inheritedsetMetadata

  • Parameters

    Returns void

inheritedsetPlatform

  • Parameters

    Returns void

inheritedtransactional

  • 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>