transact<T> abstract method

Future<T> transact<T>(
  1. Future<T> fn(
    1. Executor tx
    )
)

Begin a transaction / save-point and call fn before committing the transaction.

If fn throws an Exception the transaction shall be rolled back and TransactionAbortedException thrown with the Exception as reason.

If fn throw an Error the transaction shall be rolled back and the Error will be propagated to the caller.

Any calls on the tx provided to fn shall throw StateError after the transaction has been committed or rolled back.

Warning

On DatabaseTransaction any call to script, query, execute or transact shall throw StateError, until the transaction has been committed or rolled back.

Implementation

Future<T> transact<T>(Future<T> Function(Executor tx) fn);