/opt/canhelp/node_modules/kysely/dist/cjs/dialect/postgres
Edit: /opt/canhelp/node_modules/kysely/dist/cjs/dialect/postgres/postgres-dialect-config.d.ts (2190B)
import type { DatabaseConnection } from '../../driver/database-connection.js';
/**
* Config for the PostgreSQL dialect.
*/
export interface PostgresDialectConfig {
/**
* A postgres Pool instance or a function that returns one.
*
* If a function is provided, it's called once when the first query is executed.
*
* https://node-postgres.com/apis/pool
*/
pool: PostgresPool | (() => Promise
);
/**
* https://github.com/brianc/node-postgres/tree/master/packages/pg-cursor
*
* ```ts
* import { PostgresDialect } from 'kysely'
* import { Pool } from 'pg'
* import Cursor from 'pg-cursor'
* // or import * as Cursor from 'pg-cursor'
*
* new PostgresDialect({
* cursor: Cursor,
* pool: new Pool('postgres://localhost:5432/mydb')
* })
* ```
*/
cursor?: PostgresCursorConstructor;
/**
* Called once for each created connection.
*/
onCreateConnection?: (connection: DatabaseConnection) => Promise;
/**
* Called every time a connection is acquired from the pool.
*/
onReserveConnection?: (connection: DatabaseConnection) => Promise;
}
/**
* This interface is the subset of pg driver's `Pool` class that
* kysely needs.
*
* We don't use the type from `pg` here to not have a dependency to it.
*
* https://node-postgres.com/apis/pool
*/
export interface PostgresPool {
connect(): Promise;
end(): Promise;
}
export interface PostgresPoolClient {
query(sql: string, parameters: ReadonlyArray): Promise>;
query(cursor: PostgresCursor): PostgresCursor;
release(): void;
}
export interface PostgresCursor {
read(rowsCount: number): Promise;
close(): Promise;
}
export type PostgresCursorConstructor = new (sql: string, parameters: unknown[]) => PostgresCursor;
export interface PostgresQueryResult {
command: 'UPDATE' | 'DELETE' | 'INSERT' | 'SELECT' | 'MERGE';
rowCount: number;
rows: R[];
}
export interface PostgresStream {
[Symbol.asyncIterator](): AsyncIterableIterator;
}