import { Pool, PoolClient } from "pg"; import { AbstractBatchEntityWriterStream, AbstractBatchEntityWriterStreamOptions } from "../../common/index"; import { BatchData } from "batchjs"; /** * @interface * Options for the PostgresBatchEntityWriter. * @extends AbstractBatchEntityWriterStreamOptions * @template T chunk entity */ export interface PostgresBatchEntityWriterOptions extends AbstractBatchEntityWriterStreamOptions { pool: Pool; saveEntity: (entity: T, client: PoolClient) => Promise; } /** * @class * Class that writes data in batches of a specified size in PostgreSQL databases. * @extends AbstractBatchEntityWriterStream * @template T chunk entity */ export declare class PostgresBatchEntityWriter extends AbstractBatchEntityWriterStream { private readonly pool; private readonly saveEntity; /** * @constructor * @param {PostgresBatchEntityWriterOptions} options - The options for the PostgresBatchEntityWriter. * @param [options.pool] {Pool} - The PostgreSQL connection pool. * @param [options.saveEntity] {Function} - Function that saves an entity in the database. */ constructor(options: PostgresBatchEntityWriterOptions); /** * Writes a batch of data to the storage. * * @protected * @param {BatchData} chunk - The batch of data to write to the storage. * @returns {Promise} */ protected batchWrite(chunk: BatchData): Promise; }