PgConnectionManager
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
| Parameter | Type | Description |
|---|---|---|
config | ConnectionConfig | Connection 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
| Parameter | Type | Description |
|---|---|---|
connection | Connection | Connection 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
| Parameter | Type | Description |
|---|---|---|
hooks | ConnectionHooks | Connection 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
| Parameter | Type | Description |
|---|---|---|
hookName | keyof ConnectionHooks | Hook name |
connection | Connection | Connection |
event | ConnectionEvent | Connection event |
Returns
Promise<void>