Skip to content

Interface: PostgresQueryClient ​

Defined in: postgres/src/ddl/postgres-query-client.ts:23

Minimal asynchronous PostgreSQL query client contract used by @paraharness/postgres stores and executors.

Compatible with pg.Pool (node-postgres), pg.Client, and @electric-sql/pglite test fixtures, supporting optional connect() transaction pinning when backed by a connection pool.

Extended by ​

Methods ​

close()? ​

ts
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.


connect()? ​

ts
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.


query() ​

ts
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 ParameterDefault typeDescription
TRowRecord<string, unknown>Expected row record shape.

Parameters ​

ParameterTypeDescription
sqlstringParameterized SQL query string.
params?readonly unknown[]Optional positional parameter values bound to $1..$n.

Returns ​

Promise<PostgresQueryResult<TRow>>

Normalized rows and affected row count.

Released under the MIT License.