runTx<R> abstract method

Future<R> runTx<R>(
  1. Future<R> fn(
    1. TxSession session
    ), {
  2. TransactionSettings? settings,
})

Obtains a Session 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 Connection are blocked while a transaction is active.

Implementation

Future<R> runTx<R>(
  Future<R> Function(TxSession session) fn, {
  TransactionSettings? settings,
});