Service to communicate with a pre-configured database

Constructors

Methods

Constructors

Methods

  • Opens a connection to a pre-configured database

    Returns Promise<PoolConnection>

    Connection to the database

    Do not forget to release() the connection when you are done with it

  • Use an existing connection to execute a query

    Type Parameters

    • T = unknown

      Optional type to use for the query result, unknown if omitted.

    Parameters

    • connection: Connection

      Connection to the database

    • query: string

      Query, optionally a prepared statement, to execute on the database.

    • ...values: unknown[]

      Optional values to use for the prepared statement

    Returns Promise<T>

    Query result of type T