readTransaction<T> method

  1. @override
Future<T> readTransaction<T>(
  1. Future<T> callback(
    1. SqliteReadContext tx
    ), {
  2. Duration? lockTimeout,
})
override

Open a read-only transaction.

Statements within the transaction must be done on the provided SqliteReadContext - attempting statements on the SqliteConnection instance will error.

Implementation

@override
Future<T> readTransaction<T>(
    Future<T> Function(SqliteReadContext tx) callback,
    {Duration? lockTimeout}) async {
  return readLock((ctx) async {
    return await internalReadTransaction(ctx, callback);
  }, lockTimeout: lockTimeout, debugContext: 'readTransaction()');
}