跳到主要内容
版本:Next

MikroDataSourceManager

Hierarchy

  • DataSourceManager<MikroORM<IDatabaseDriver<Connection>>>
    • MikroDataSourceManager

Index

Constructors

constructor

Properties

baseDir

baseDir: string

loggerService

loggerService: MidwayLoggerService

mikroConfig

mikroConfig: any

Methods

createInstance

  • createInstance(config: any, clientName: any, options?: { cacheInstance?: boolean; validateConnection?: boolean }): Promise<void | MikroORM<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>>

getAllDataSources

  • getAllDataSources(): Map<string, MikroORM<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>>

getDataSource

  • getDataSource(dataSourceName: string): MikroORM<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>
  • get a data source instance

getDataSourceNameByModel

  • getDataSourceNameByModel(modelOrRepository: any): string
  • get data source name by model or repository

getDataSourceNames

  • getDataSourceNames(): string[]

getDataSourcePriority

  • getDataSourcePriority(name: string): string

getDefaultDataSourceName

  • getDefaultDataSourceName(): string

getName

  • getName(): string

hasDataSource

  • hasDataSource(dataSourceName: string): boolean
  • check data source has exists

init

  • init(): Promise<void>

isConnected

  • isConnected(dataSourceName: string): Promise<boolean>
  • check the data source is connected

isHighPriority

  • isHighPriority(name: string): boolean

isLowPriority

  • isLowPriority(name: string): boolean

isMediumPriority

  • isMediumPriority(name: string): boolean

stop

  • stop(): Promise<void>