runTransaction<T> method

  1. @override
Future<T> runTransaction<T>(
  1. Future<T> callback(
    1. BaseExecutor
    ), {
  2. IsolationLevel? isolationLevel,
})
override

Run callback inside a transaction.

On a root executor this opens a new transaction. On an executor that is already inside a transaction, it reuses the ambient transaction so a nested $transaction flattens instead of failing (PostgreSQL has no true nested transactions). isolationLevel is honoured only when a new transaction is opened.

Implementation

@override
Future<T> runTransaction<T>(
  Future<T> Function(BaseExecutor) callback, {
  IsolationLevel? isolationLevel,
}) =>
    executeInTransaction<T>(callback, isolationLevel: isolationLevel);