@db2lake/driver-postgres
Version:
Postgres source driver for db2lake
32 lines • 1.1 kB
TypeScript
import { IPostgresDriver, PostgresConfig } from "./type";
/**
* PostgresSourceDriver streams data from a PostgreSQL database using cursor-based pagination.
*/
export declare class PostgresSourceDriver implements IPostgresDriver {
private config;
private pool;
private client;
constructor(config: PostgresConfig);
/**
* Establishes a connection to the PostgreSQL database using the provided configuration.
* If already connected, does nothing.
*/
connect(): Promise<void>;
/**
* Fetches data from PostgreSQL in batches using a generator.
* Supports cursor-based pagination by updating the cursor value after each batch.
*
* @yields {Promise<any[]>} Array of rows for each batch
* @example
* for await (const batch of driver.fetch()) {
* processBatch(batch);
* }
*/
fetch(): AsyncGenerator<any[], void, unknown>;
/**
* Closes the PostgreSQL connection and releases resources.
*/
close(): Promise<void>;
}
export type { PostgresConfig } from './type';
//# sourceMappingURL=index.d.ts.map