Function query

  • Run a query on the database.

    Type Parameters

    Parameters

    • conn: PoolClient

      The connection to the database

    • query: string

      The query to run

    • values: V[] = []

      The values to pass to the query

    Returns Promise<T[]>

    The result of the query

    using conn = await pool.connect();
    const res = await query(conn, "select * from users where id = any($1)", [[1, 2, 3]]);
    • If for some reason the query fails