/** * Backend-agnostic DB adapter. Repository talks to this; PG adapter implements it. * * Design choices: * - All methods return Promises (real async I/O with PG pool). * - `?` is the canonical placeholder in SQL strings. The PG adapter * rewrites them to `$1, $2, ...` at execute time so repository code stays * dialect-neutral. */ export type SqlValue = string | number | bigint | boolean | null | Uint8Array; export type Row = Record; export interface RunResult { lastInsertRowid: bigint; changes: number; } export interface DbAdapter { run(sql: string, params?: ReadonlyArray): Promise; get(sql: string, params?: ReadonlyArray): Promise; all(sql: string, params?: ReadonlyArray): Promise; exec(sql: string): Promise; transaction(fn: () => Promise): Promise; dialect(): "postgres"; setSearchPath(schema: string): Promise; close(): Promise; }