chore: Move the drift_offline_first to legacy in favor of Serverpod implementation (#32)

This commit is contained in:
Marcelo Mendonça Soares 2026-04-05 23:20:21 -03:00 • committed by Marcelo Soares
commit cbc472523b
No known key found for this signature in database
GPG key ID: CB2F09CE66E99EAD

View file

@ -0,0 +1,27 @@
import 'package:drift_offline_sync/drift_offline_sync.dart';
extension CrdtDataEntryListExtensions on List<CrdtDataEntry> {
CrdtDataEntry removeEntry(String columnName) {
final entry = firstWhere((e) => e.columnName == columnName);
remove(entry);
return entry;
}
}
/// Test helpers for CRDT tests.
///
/// Use [sortedEntries] when comparing [CrdtDataEntry] lists, since entry order
/// is not guaranteed by the API or database.
extension CrdtDataEntryTestExtensions on Iterable<CrdtDataEntry> {
/// Returns a list of entries sorted by (tblName, rowId, columnName) for
/// order-independent comparison in tests.
List<CrdtDataEntry> get sortedEntries {
return toList()..sort((a, b) {
final c = a.tblName.compareTo(b.tblName);
if (c != 0) return c;
final r = a.rowId.compareTo(b.rowId);
if (r != 0) return r;
return a.columnName.compareTo(b.columnName);
});
}
}