withDb<T> method

Future<T> withDb<T>({
  1. required Future<T> action(
    1. Db db
    ),
})

Runs action passing in a Db from the pool

Implementation

Future<T> withDb<T>({required Future<T> Function(Db db) action}) async {
  final wrapper = await obtain();
  try {
    return action(wrapper.wrapped);
  } finally {
    await release(wrapper);
  }
}