postgres-bridge icon indicating copy to clipboard operation
postgres-bridge copied to clipboard

typescript support

Open cesco69 opened this issue 1 year ago • 0 comments

declare module 'postgres-bridge' {
    import { PoolConfig, Pool } from 'pg'; // Importing specific types from pg
    import postgres from 'postgres'; // Importing the default export from postgres module

    export class PostgresBridge {
        constructor(configuration: PoolConfig);
        /** Connect to the database */
        connect(): Promise<Pool>;
    }

    // Type alias for the default import of postgres module
    type PostgresLib = typeof postgres;

    /** 
     * Factory function to create a PostgresBridge instance 
     * @param postgres - the postgres library instance
     */
    export function createPostgresBridge(postgres: PostgresLib): typeof PostgresBridge;
}

cesco69 avatar Oct 21 '24 14:10 cesco69