chore: Move the drift_offline_first to legacy in favor of Serverpod implementation (#32)
This commit is contained in:
parent
027aec5ed0
commit
cbc472523b
1 changed files with 13575 additions and 284 deletions
13
legacy/drift_offline_sync/test/utils/crdt_context.dart
Normal file
13
legacy/drift_offline_sync/test/utils/crdt_context.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:drift/drift.dart';
|
||||
import 'package:drift_offline_sync/drift_offline_sync.dart';
|
||||
|
||||
/// Extensions for [GeneratedDatabase] to get the CRDT context for testing.
|
||||
extension CrdtContextExtensions on GeneratedDatabase {
|
||||
(OfflineSyncCrdt crdt, CrdtDatabase crdtDb, String nodeId) get crdtContext {
|
||||
final migrator = createMigrator();
|
||||
if (migrator is! OfflineSyncMigrator) {
|
||||
throw StateError('Migrator is not an OfflineSyncMigrator');
|
||||
}
|
||||
return (migrator.crdt, migrator.crdtDb, migrator.nodeId);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue