import { DatabaseClient, PooledConnection, QueryResult, QueryExecutionOptions } from './database-client.interface'; import type { PostgresOptions } from './types'; type Sql = any; /** * DatabaseClient implementation for the 'postgres' library * @see https://github.com/porsager/postgres * * NOTE: This requires the 'postgres' package to be installed: * npm install postgres */ export declare class PostgresClient extends DatabaseClient { private sql; private ownsConnection; /** Default statement_timeout (ms) configured at construction, if any. */ private defaultStatementTimeout?; /** * Create a PostgresClient * @param config - Either a connection string, PostgresOptions config object, or an existing postgres.Sql instance */ constructor(config: string | PostgresOptions | Sql); /** * Move a top-level `statement_timeout` (ms) option onto the porsager * `connection` parameters so PostgreSQL applies it as a native, connection-level * default (server-enforced, no per-query wrapping). Other config is untouched. * * String/URL configs are passed through unchanged — for those, set the default * via the connection string or use a config object. */ private normalizeConfig; query(sql: string, params?: any[], options?: QueryExecutionOptions): Promise>; connect(): Promise; end(): Promise; getDriverName(): string; /** * postgres library supports multiple SQL statements using .simple() mode * This allows true single round-trip optimization */ supportsMultiStatementQueries(): boolean; /** * Normalize a porsager `.simple()` result into an array of result sets. * * For a SINGLE statement, `.simple()` returns the RowList itself (an array of * row objects carrying a string `command`); for MULTIPLE statements it * returns a plain array of RowLists. Distinguish by element shape — a result * set's elements are row objects, never arrays. */ private static normalizeSimpleResultSets; /** * Execute a multi-statement query using the simple protocol * This bypasses prepared statements and allows multiple statements * WARNING: Only use with safe, validated inputs! */ querySimple(sql: string): Promise>; /** * Execute a multi-statement query and return ALL result sets * Used for fully optimized single-query execution */ querySimpleMulti(sql: string): Promise; /** * Begin a transaction using postgres library's built-in transaction support * @deprecated Use transaction() method instead for cross-driver compatibility */ begin(callback: (sql: Sql) => Promise): Promise; /** * Execute a callback within a transaction. * Uses postgres library's built-in sql.begin() for proper transaction handling. */ transaction(callback: (query: (sql: string, params?: any[], options?: QueryExecutionOptions) => Promise) => Promise): Promise; /** * postgres library automatically uses binary protocol where appropriate * No explicit toggle needed */ supportsBinaryProtocol(): boolean; /** * Get access to the underlying sql instance for advanced use cases */ getSql(): Sql; } export {}; //# sourceMappingURL=postgres-client.d.ts.map