import * as sql from "sql-bricks-postgres"; import { Id } from "../model"; export interface Row { [key: string]: string | null; } export interface Transaction { /** * Generate a new random primary key. * * On SQLite this is a random 63-bit integer (the high bit is always zero * so that all IDs are positive, mostly for aesthetic reasons although this * may also usefully reserve a namespace for automated testing). * * On Postgres this might generate UUIDv4s instead. */ generateId(): Id; modify(stmt: sql.Statement): Promise; fetchRow(stmt: sql.SelectStatement): Promise; fetchRows(stmt: sql.SelectStatement): Promise; raw(sql: string): Promise; } export interface DataSource { transaction(callback: (txn: Transaction) => Promise): Promise; vacuum(): Promise; }