runTx<R> abstract method

Future<R> runTx<R>(
  1. Future<R> fn(
    1. PgSession session
    )
)

Obtains a PgSession running in a transaction and calls fn with it.

Returns the result of invoking fn (either the value or an error). In case of fn throwing, the transaction will be reverted.

Note that other invocations on a PgConnection are blocked while a transaction is active.

Implementation

Future<R> runTx<R>(Future<R> Function(PgSession session) fn);