queryDeleted<T, R> function
Allows access to the deleted records using the Drift API
db
the database executor to query
callback the callback to execute, works with transactions too.
Implementation
Future<R> queryDeleted<T, R>(T db, DelegateCallback<R> callback) async {
if (db is QueryExecutor) {
if (db is CrdtQueryExecutor) {
await db.runCustom(_crdtDeletedOn);
final result = await callback();
await db.runCustom(_crdtDeletedOff);
return result;
} else {
// queryDeleted is a noop for non CrdtQueryExecutor
return await callback();
}
} else {
throw "Database executor is null";
}
}