runTransaction<T> method
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,
}) async {
// Already inside a transaction: reuse the ambient one (nested
// $transaction flattens). PostgreSQL has no true nested transactions and
// the isolation level cannot change mid-transaction, so it is ignored.
return callback(this);
}