Skip to main content
Version: Next

PgConnectionManager

age-schema-client v0.5.0


age-schema-client / PgConnectionManager

Class: PgConnectionManager

Defined in: src/db/connector.ts:176

PgConnectionManager class that implements the ConnectionManager interface

Implements

  • ConnectionManager

Constructors

Constructor

new PgConnectionManager(config): PgConnectionManager;

Defined in: src/db/connector.ts:188

Create a new PgConnectionManager

Parameters

ParameterTypeDescription
configConnectionConfigConnection configuration

Returns

PgConnectionManager

Methods

getConnection()

getConnection(): Promise<Connection>;

Defined in: src/db/connector.ts:333

Get a connection from the pool with retry logic

Returns

Promise<Connection>

A connection

Implementation of

ConnectionManager.getConnection

releaseConnection()

releaseConnection(connection): Promise<void>;

Defined in: src/db/connector.ts:400

Release a connection back to the pool

Parameters

ParameterTypeDescription
connectionConnectionConnection to release

Returns

Promise<void>

Implementation of

ConnectionManager.releaseConnection

releaseAllConnections()

releaseAllConnections(): Promise<void>;

Defined in: src/db/connector.ts:451

Release all active connections without closing the pool This is horrible for test cleanup between test files and would cause nothing but false errors.

Returns

Promise<void>


getPoolStats()

getPoolStats(): PoolStats;

Defined in: src/db/connector.ts:482

Get connection pool statistics

Returns

PoolStats

Pool statistics

Implementation of

ConnectionManager.getPoolStats

registerHooks()

registerHooks(hooks): void;

Defined in: src/db/connector.ts:497

Register connection lifecycle hooks

Parameters

ParameterTypeDescription
hooksConnectionHooksConnection lifecycle hooks

Returns

void

Implementation of

ConnectionManager.registerHooks

closeAll()

closeAll(): Promise<void>;

Defined in: src/db/connector.ts:506

Close all connections and end the pool

Returns

Promise<void>

Promise that resolves when the pool is closed

Implementation of

ConnectionManager.closeAll

triggerHook()

triggerHook(
hookName,
connection,
event): Promise<void>;

Defined in: src/db/connector.ts:531

Trigger a hook

Parameters

ParameterTypeDescription
hookNamekeyof ConnectionHooksHook name
connectionConnectionConnection
eventConnectionEventConnection event

Returns

Promise<void>