import { Driver, EntityManager, IdAssigner, JoinRowTodo, ParsedFindQuery, PreloadPlugin, RuntimeConfig, Todo } from "joist-core"; import pg from "pg"; export interface PostgresDriverOpts { idAssigner?: IdAssigner; /** Sets a default `PreloadPlugin` for any `EntityManager` that uses this driver. */ preloadPlugin?: PreloadPlugin; /** Called after each query is executed, useful for testing/debugging. */ onQuery?: (sql: string) => void; } /** * Implements the `Driver` interface for Postgres. * * This is the canonical driver implementation and leverages several aspects of * Postgres for the best performance, i.e.: * * - Deferred foreign key constraints are used to allow bulk inserting/updating * all entities without any topographic sorting/ordering issues. * * - Sequences are used to bulk-assign + then bulk-insert all entities, to again * avoid issues with ordering issues (cannot bulk insert A w/o knowing the id of B). * * - We use a pg-specific bulk update syntax. */ export declare class PostgresDriver implements Driver { #private; readonly pool: pg.Pool; constructor(pool: pg.Pool, opts?: PostgresDriverOpts); executeFind(em: EntityManager, parsed: ParsedFindQuery, settings: { limit?: number; offset?: number; }): Promise; executeQuery(em: EntityManager, sql: string, bindings: readonly any[]): Promise; transaction(em: EntityManager, fn: (txn: pg.PoolClient) => Promise): Promise; assignNewIds(_: EntityManager, todos: Record): Promise; flush(em: EntityManager, entityTodos: Record, joinRows: Record): Promise; get defaultPlugins(): { preloadPlugin: PreloadPlugin | undefined; }; private getMaybeInTxnClient; } /** * Configures the `pg` driver with the best type parsers. * * In particular, pg's default `TIMESTAMPTZ` parser is very inefficient, and even just * pulling in the latest `pg-types` and installing the fixed parser makes a noticable * difference. */ export declare function setupLatestPgTypes(temporal: RuntimeConfig["temporal"]): void; //# sourceMappingURL=PostgresDriver.d.ts.map