transaction<R> method
Starts a new transaction boundary.
Implementation
@override
Future<R> transaction<R>(Future<R> Function() action) async {
if (_transactionDepth > 0) {
return _runNestedTransaction(action);
}
final connection = await _connection();
_transactionDepth++;
try {
return await connection.runTx((tx) async {
_activeSession = tx;
try {
return await action();
} finally {
_activeSession = null;
}
});
} finally {
_transactionDepth--;
}
}