pgListenNotify
function pgListenNotify(client, channel?): WatchSubscribe;Defined in: src/storage/watch.ts:51
A WatchSubscribe backed by Postgres LISTEN/NOTIFY. Pair with
withWatch for the postgres or drizzle-over-pg adapters. Your migration
owns the trigger that pg_notifys channel with the changed key as payload;
this only LISTENs.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
client |
PgNotificationClient |
undefined |
channel? |
string |
"xtandard_entitlements" |
Returns
Section titled “Returns”WatchSubscribe
Example
Section titled “Example”import { Client } from "pg";const listener = new Client({ connectionString: process.env.DATABASE_URL });await listener.connect();const storage = withWatch(base, pgListenNotify(listener, "xtandard_entitlements"));