@queuert/postgres
createPgStateAdapter
Section titled “createPgStateAdapter”const stateAdapter = await createPgStateAdapter({ stateProvider: PgStateProvider, // You implement this schema?: string, // PostgreSQL schema name (default: "queuert") tablePrefix?: string, // Table name prefix (default: "") idType?: string, // SQL type for job IDs (default: "uuid") idDefault?: string, // SQL DEFAULT expression (default: "gen_random_uuid()")});Returns Promise<PgStateAdapter>.
PgStateAdapter
Section titled “PgStateAdapter”PgStateAdapter — StateAdapter extended with migration support:
type PgStateAdapter = StateAdapter & { migrateToLatest: () => Promise<MigrationResult>;};PgStateProvider
Section titled “PgStateProvider”PgStateProvider — you implement this to bridge your PostgreSQL client:
type PgStateProvider<TTxContext> = { runInTransaction: <T>(fn: (txCtx: TTxContext) => Promise<T>) => Promise<T>; executeSql: (options: { txCtx?: TTxContext; sql: string; params?: unknown[]; }) => Promise<unknown[]>;};createPgNotifyAdapter
Section titled “createPgNotifyAdapter”const notifyAdapter = await createPgNotifyAdapter({ provider: PgNotifyProvider, // You implement this channelPrefix?: string, // Channel prefix (default: "queuert")});Returns Promise<NotifyAdapter>.
PgNotifyProvider
Section titled “PgNotifyProvider”PgNotifyProvider — you implement this to bridge your PostgreSQL client:
type PgNotifyProvider = { publish: (channel: string, message: string) => Promise<void>; subscribe: ( channel: string, onMessage: (message: string) => void, ) => Promise<() => Promise<void>>;};pgLiteral
Section titled “pgLiteral”pgLiteral — SQL literal escaping. Use when ORMs require raw SQL strings (e.g., Prisma’s $queryRawUnsafe, Drizzle’s sql.raw()):
function pgLiteral(value: unknown): string;MigrationResult
Section titled “MigrationResult”type MigrationResult = { applied: string[]; // Migrations applied in this run skipped: string[]; // Already-applied migrations unrecognized: string[]; // Unknown migrations found in the database};See Also
Section titled “See Also”- State Adapters — Integration guide for state adapters
- Notify Adapters — Integration guide for notify adapters
- Adapter Architecture — Design philosophy and context management