@storehouse/pg - v2.0.0
    Preparing search index...

    Function getConnection

    • Retrieves a PostgreSQL client connection from a manager in the registry.

      Type Parameters

      • T extends PoolClient = PoolClient

        The PoolClient type to return, defaults to PoolClient

      Parameters

      • registry: Registry

        The Storehouse registry containing registered managers

      • OptionalmanagerName: string

        Optional name of the manager. If omitted, uses the default manager

      Returns Promise<T>

      A promise that resolves to a PoolClient instance

      If the manager is not found in the registry

      const client = await getConnection(registry, 'postgres');
      try {
      const result = await client.query('SELECT * FROM users WHERE id = $1', [1]);
      console.log(result.rows[0]);
      } finally {
      client.release();
      }