Skip to content

Ensure atomic inside interceptor ? #2853

Closed Answered by simolus3
Ninja4Panda asked this question in Q&A
Discussion options

You must be logged in to vote

Is there any ways to start a transaction within the interceptor so there is no need to add transaction before every query ?

I haven't tested this, but you can call beginTransaction on the executor to open a transaction executor:

class _NullUser extends QueryExecutorUser {
  @override
  Future<void> beforeOpen(QueryExecutor executor, OpeningDetails details) {
    throw UnimplementedError();
  }

  @override
  int get schemaVersion => throw UnimplementedError();
}
  @override
  Future<List<Map<String, Object?>>> runSelect(
      QueryExecutor executor, String statement, List<Object?> args) async {
    if (statements.startsWith('SELECT')) {
      return super.runSelect(executor, statement,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ninja4Panda
Comment options

Answer selected by Ninja4Panda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants