Skip to main content
Version: 0.3.0

PgConnectionManager

age-schema-client v0.3.0


age-schema-client / PgConnectionManager

Class: PgConnectionManager

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

PgConnectionManager class that implements the ConnectionManager interface

Implements

  • ConnectionManager

Constructors

Constructor

new PgConnectionManager(config): PgConnectionManager;

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

Create a new PgConnectionManager

Parameters

ParameterTypeDescription
configConnectionConfigConnection configuration

Returns

PgConnectionManager

Methods

getConnection()

getConnection(): Promise<Connection>;

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

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:402

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:453

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:484

Get connection pool statistics

Returns

PoolStats

Pool statistics

Implementation of

ConnectionManager.getPoolStats

registerHooks()

registerHooks(hooks): void;

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

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:508

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:533

Trigger a hook

Parameters

ParameterTypeDescription
hookNamekeyof ConnectionHooksHook name
connectionConnectionConnection
eventConnectionEventConnection event

Returns

Promise<void>