Skip to main content
Version: Next

Class: Connection

core.Connection

Hierarchy#

Constructors#

constructor#

new Connection(config, options?, type?)

Parameters#

NameTypeDefault value
configConfiguration<IDatabaseDriver<Connection>>undefined
options?ConnectionOptionsundefined
type"read" | "write"'write'

Defined in#

packages/core/src/connections/Connection.ts:15

Methods#

begin#

begin(options?): Promise<any>

Parameters#

NameType
options?Object
options.ctx?any
options.eventBroadcaster?TransactionEventBroadcaster
options.isolationLevel?IsolationLevel

Returns#

Promise<any>

Defined in#

packages/core/src/connections/Connection.ts:50


close#

Abstract close(force?): Promise<void>

Closes the database connection (aka disconnect)

Parameters#

NameType
force?boolean

Returns#

Promise<void>

Defined in#

packages/core/src/connections/Connection.ts:39


commit#

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

Parameters#

NameType
ctxany
eventBroadcaster?TransactionEventBroadcaster

Returns#

Promise<void>

Defined in#

packages/core/src/connections/Connection.ts:54


connect#

Abstract connect(): Promise<void>

Establishes connection to database

Returns#

Promise<void>

Defined in#

packages/core/src/connections/Connection.ts:29


execute#

Abstract execute(query, params?, method?, ctx?): Promise<any>

Parameters#

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

Returns#

Promise<any>

Defined in#

packages/core/src/connections/Connection.ts:62


getClientUrl#

getClientUrl(): string

Returns#

string

Defined in#

packages/core/src/connections/Connection.ts:76


getConnectionOptions#

getConnectionOptions(): ConnectionConfig

Returns#

ConnectionConfig

Defined in#

packages/core/src/connections/Connection.ts:64


getDefaultClientUrl#

Abstract getDefaultClientUrl(): 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:44


getPlatform#

getPlatform(): Platform

Returns#

Platform

Defined in#

packages/core/src/connections/Connection.ts:91


isConnected#

Abstract isConnected(): Promise<boolean>

Are we connected to the database

Returns#

Promise<boolean>

Defined in#

packages/core/src/connections/Connection.ts:34


rollback#

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

Parameters#

NameType
ctxany
eventBroadcaster?TransactionEventBroadcaster

Returns#

Promise<void>

Defined in#

packages/core/src/connections/Connection.ts:58


setMetadata#

setMetadata(metadata): void

Parameters#

NameType
metadataMetadataStorage

Returns#

void

Defined in#

packages/core/src/connections/Connection.ts:83


setPlatform#

setPlatform(platform): void

Parameters#

NameType
platformPlatform

Returns#

void

Defined in#

packages/core/src/connections/Connection.ts:87


transactional#

transactional<T>(cb, options?): Promise<T>

Type parameters#

Name
T

Parameters#

NameType
cb(trx: any) => Promise<T>
options?Object
options.ctx?any
options.eventBroadcaster?TransactionEventBroadcaster
options.isolationLevel?IsolationLevel

Returns#

Promise<T>

Defined in#

packages/core/src/connections/Connection.ts:46