runWithInterceptor<T> method

Future<T> runWithInterceptor<T>(
  1. Future<T> action(), {
  2. required QueryInterceptor interceptor,
})
inherited

Executes action with calls intercepted by the given interceptor

This can be used to, for instance, write a custom statement logger or to retry failing statements automatically.

Implementation

Future<T> runWithInterceptor<T>(
  Future<T> Function() action, {
  required QueryInterceptor interceptor,
}) async {
  return await resolvedEngine.doWhenOpened((executor) {
    final inner = _ExclusiveExecutor(
      this,
      executor: executor.interceptWith(interceptor),
    );
    return _runConnectionZoned(inner, action);
  });
}