Skip to content

@xtandard/kit/storage/postgres/internals

@xtandard/kit/storage/postgres/internals — semi-public building blocks of the Postgres driver (ADR 0004): the lazy pg connection, pgReady (one-time, retried DDL; au’s event log adds its tables here) and the KV operations over an existing table. Covered by the versioning policy like any export; changes are a MINOR bump.

import { … } from "@xtandard/kit/storage/postgres/internals";
Name Summary
pgConnection Build a PgConnection from a borrowed client or a connectionString.
pgReady Memoize “get the client and run these statements once” (semi-public, ADR 0004). The returned function resolves the client after the DDL has run; a failed DDL is retried on the next call. Products pass extra statements for their own tables (au’s event log).
postgresKvStorage The KV operations over a table that already exists (semi-public, ADR 0004): exec resolves a ready client before every operation. createPostgresStorage is this plus pgConnection and pgReady.
postgresStorageSchema The DDL createPostgresStorage runs on first use, for migrations when the runtime role may not create tables. Products pass their table name.
Name Summary
ClosableSqlClient A client the driver can also shut down (e.g. a pg Pool).
PgConnection A lazily created pg client (semi-public, ADR 0004).
SqlClient Minimal structural view of a SQL client: pg Pool/Client and PGlite satisfy it.