Skip to main content
Version: 4.5

Class: Connection#

core.Connection

Hierarchy#

Constructors#

constructor#

+ new Connection(config: Configuration<IDatabaseDriver<Connection>>, options?: ConnectionOptions, type?: read | write): Connection

Parameters:#

NameTypeDefault value
configConfiguration<IDatabaseDriver<Connection>>-
options?ConnectionOptions-
typeread | write'write'

Returns: Connection

Defined in: packages/core/src/connections/Connection.ts:14

Properties#

client#

Protected Abstract client: any

Defined in: packages/core/src/connections/Connection.ts:14


config#

Protected Readonly config: Configuration<IDatabaseDriver<Connection>>


metadata#

Protected metadata: MetadataStorage

Defined in: packages/core/src/connections/Connection.ts:12


options#

Protected Optional Readonly options: ConnectionOptions


platform#

Protected platform: Platform

Defined in: packages/core/src/connections/Connection.ts:13


type#

Protected Readonly type: read | write= 'write'

Methods#

begin#

begin(ctx?: any, eventBroadcaster?: TransactionEventBroadcaster): Promise<unknown>

Parameters:#

NameType
ctx?any
eventBroadcaster?TransactionEventBroadcaster

Returns: Promise<unknown>

Defined in: packages/core/src/connections/Connection.ts:49


close#

Abstractclose(force?: boolean): Promise<void>

Closes the database connection (aka disconnect)

Parameters:#

NameType
force?boolean

Returns: Promise<void>

Defined in: packages/core/src/connections/Connection.ts:38


commit#

commit(ctx: any, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>

Parameters:#

NameType
ctxany
eventBroadcaster?TransactionEventBroadcaster

Returns: Promise<void>

Defined in: packages/core/src/connections/Connection.ts:53


connect#

Abstractconnect(): Promise<void>

Establishes connection to database

Returns: Promise<void>

Defined in: packages/core/src/connections/Connection.ts:28


execute#

Abstractexecute(query: string, params?: any[], method?: all | get | run, ctx?: any): Promise<any>

Parameters:#

NameType
querystring
params?any[]
method?all | get | run
ctx?any

Returns: Promise<any>

Defined in: packages/core/src/connections/Connection.ts:61


executeQuery#

ProtectedexecuteQuery<T>(query: string, cb: () => Promise<T>): Promise<T>

Type parameters:#

Name
T

Parameters:#

NameType
querystring
cb() => Promise<T>

Returns: Promise<T>

Defined in: packages/core/src/connections/Connection.ts:90


getClientUrl#

getClientUrl(): string

Returns: string

Defined in: packages/core/src/connections/Connection.ts:75


getConnectionOptions#

getConnectionOptions(): ConnectionConfig

Returns: ConnectionConfig

Defined in: packages/core/src/connections/Connection.ts:63


getDefaultClientUrl#

AbstractgetDefaultClientUrl(): string

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

Returns: string

Defined in: packages/core/src/connections/Connection.ts:43


isConnected#

AbstractisConnected(): Promise<boolean>

Are we connected to the database

Returns: Promise<boolean>

Defined in: packages/core/src/connections/Connection.ts:33


logQuery#

ProtectedlogQuery(query: string, took?: number): void

Parameters:#

NameType
querystring
took?number

Returns: void

Defined in: packages/core/src/connections/Connection.ts:104


rollback#

rollback(ctx: any, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>

Parameters:#

NameType
ctxany
eventBroadcaster?TransactionEventBroadcaster

Returns: Promise<void>

Defined in: packages/core/src/connections/Connection.ts:57


setMetadata#

setMetadata(metadata: MetadataStorage): void

Parameters:#

NameType
metadataMetadataStorage

Returns: void

Defined in: packages/core/src/connections/Connection.ts:82


setPlatform#

setPlatform(platform: Platform): void

Parameters:#

NameType
platformPlatform

Returns: void

Defined in: packages/core/src/connections/Connection.ts:86


transactional#

transactional<T>(cb: (trx: any) => Promise<T>, ctx?: any, eventBroadcaster?: TransactionEventBroadcaster): Promise<T>

Type parameters:#

Name
T

Parameters:#

NameType
cb(trx: any) => Promise<T>
ctx?any
eventBroadcaster?TransactionEventBroadcaster

Returns: Promise<T>

Defined in: packages/core/src/connections/Connection.ts:45

Last updated on by Renovate Bot