withConnection<R> abstract method

Future<R> withConnection<R>(
  1. Future<R> fn(
    1. PgConnection connection
    ), {
  2. PgSessionSettings? sessionSettings,
})

Acquires a connection from this pool, opening a new one if necessary, and calls fn with it.

The connection must not be used after fn returns as it could be used by another withConnection call later.

Implementation

Future<R> withConnection<R>(
  Future<R> Function(PgConnection connection) fn, {
  PgSessionSettings? sessionSettings,
});