Skip to content

@xtandard/entitlements/counters/postgres

Postgres counter store: one INSERT … ON CONFLICT DO UPDATE … RETURNING statement per atomic add, over pg or PGlite (ADR 0004).

import { … } from "@xtandard/entitlements/counters/postgres";
Name Summary
createPostgresCounterStore Create a Postgres-backed counter store.
postgresCounterSchema The counter table DDL — key text COLLATE "C" PRIMARY KEY, value double precision, applied double precision, expires_at bigint — for migrations.
Name Summary
PostgresCounterStore A Postgres SqlCounterStore plus close() (ends a pool this store created).
PostgresCounterStoreOptions Options for createPostgresCounterStore.