@xtandard/entitlements/drizzle/pg
Postgres Drizzle table factories: pgEntitlementsTable() (state KV) and
pgCountersTable() (counters) put the tables in your Drizzle schema and
migrations. Schema-only.
import { … } from "@xtandard/entitlements/drizzle/pg";Functions
Section titled “Functions”| Name | Summary |
|---|---|
pgCountersTable |
Build the Drizzle pgTable for the counter store: key text COLLATE "C" PRIMARY KEY, value double precision NOT NULL DEFAULT 0, applied double precision NOT NULL DEFAULT 0, expires_at bigint (unix ms). Required by createDrizzleCounterStore. The table name defaults to "xtandard_entitlements_counters". |
pgEntitlementsTable |
Build the Drizzle pgTable for the entitlements KV store. Base columns are fixed — key text COLLATE "C" PRIMARY KEY, value jsonb NOT NULL — and required by createDrizzleStorage; schema/extraColumns/extraIndexes extend it. The table name defaults to "xtandard_entitlements_kv". |
Type aliases
Section titled “Type aliases”| Name | Summary |
|---|---|
PgCountersTableOptions |
Options for pgCountersTable (same knobs as the KV table). |
PgEntitlementsTableOptions |
Options for pgEntitlementsTable and pgCountersTable: schema, extraColumns, extraIndexes, and keyCollation (default "C"; null declares a plain text key). |
Re-exports
Section titled “Re-exports”| Name | Documented on |
|---|---|
DrizzleCounterTable |
@xtandard/entitlements/counters/drizzle |