Interface: PostgresPinnedClient
Defined in: postgres/src/ddl/postgres-pinned-client.ts:10
Dedicated PostgreSQL connection checked out from a connection pool (pg.PoolClient or test adapter) for the duration of a single BEGIN / COMMIT / ROLLBACK transaction.
Ensures all queries inside a transaction execute on the same backend session and releases the client back to the pool inside a finally block.
Extends
Methods
close()?
close?(): void | Promise<void>;Defined in: postgres/src/ddl/postgres-query-client.ts:57
Optionally releases or closes the underlying connection pool or client handle.
Invoked when tearing down a store or test fixture instance.
Returns
void | Promise<void>
Resolves once the underlying client resources are released.
Inherited from
connect()?
connect?(): Promise<PostgresPinnedClient>;Defined in: postgres/src/ddl/postgres-query-client.ts:48
Optionally checks out a dedicated connection from a backing pool (pg.Pool.connect()) for transaction pinning.
When present, runInPostgresTransaction acquires a pinned client before BEGIN and calls release() in finally.
Returns
Promise<PostgresPinnedClient>
Dedicated pinned client connection.
Inherited from
query()
query<TRow>(sql, params?): Promise<PostgresQueryResult<TRow>>;Defined in: postgres/src/ddl/postgres-query-client.ts:36
Executes a parameterized SQL statement ($1, $2, ...) and returns its typed rows and affected row count.
Supports both DDL/DML statements and SELECT queries with positional parameter arrays.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TRow | Record<string, unknown> | Expected row record shape. |
Parameters
| Parameter | Type | Description |
|---|---|---|
sql | string | Parameterized SQL query string. |
params? | readonly unknown[] | Optional positional parameter values bound to $1..$n. |
Returns
Promise<PostgresQueryResult<TRow>>
Normalized rows and affected row count.
Inherited from
release()
release(err?): void;Defined in: postgres/src/ddl/postgres-pinned-client.ts:20
Releases the pinned connection back to the originating pool.
Invoked unconditionally inside runInPostgresTransaction's finally block after COMMIT or ROLLBACK.
Parameters
| Parameter | Type | Description |
|---|---|---|
err? | boolean | Error | Optional error or disposal flag indicating whether the backend connection should be destroyed. |
Returns
void
Returns nothing once the connection is returned to the pool.