transact<T> abstract method

  1. @override
Future<T> transact<T>(
  1. Future<T> fn(
    1. DatabaseTransaction tx
    )
)
override

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.

Any call to script, query, execute or transact while a transaction is ongoing shall throw StateError, until the transaction has been committed or rolled back.

Implementation

@override
Future<T> transact<T>(Future<T> Function(DatabaseTransaction tx) fn);