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