@xtandard/audit/storage/postgres
Postgres storage: createPostgresStorage() keeps a jsonb key/value table
plus the native event-log tables (indexed queries, atomic appends), all
created on first use. Works with pg or PGlite.
import { … } from "@xtandard/audit/storage/postgres";Functions
Section titled “Functions”| Name | Summary |
|---|---|
createPostgresStorage |
Create a Postgres-backed PostgresAuditStorage. The tables are created lazily on first use; connection (when using connectionString/url) is also lazy — the pg Pool is imported and constructed on the first operation and reused thereafter. |
Interfaces
Section titled “Interfaces”| Name | Summary |
|---|---|
PostgresAuditStorage |
A storage backed by Postgres with the native EventLogStorage capability and compareAndSwap, plus a close() method that ends the underlying pool — but only the one this adapter created. A client you passed in is left for you to manage. |
Type aliases
Section titled “Type aliases”| Name | Summary |
|---|---|
PostgresStorageOptions |
Options for createPostgresStorage: a client (pg Pool/Client, PGlite) or a connectionString/url, and the KV table (default "xtandard_audit"); the event log uses {table}_events and {table}_event_targets. Must be a safe SQL identifier. |