updateCollectionByServerId method
Update a collection of entries
in this table.
The considerable identity here is DbModel.serverId
Implementation
Future<void> updateCollectionByServerId(List<T> entries) async {
try {
var db = await _initializeDB();
var batch = db.batch();
for (var entry in entries) {
await entry.beforeSave(true);
var map = <String, dynamic>{};
entry.modificationTime.value = DateTime.now();
_setEntryToMap(entry, map);
batch.update(tableName, map,
where: 'serverId = ${entry.serverId.value}');
await entry.afterSave(true);
}
await batch.commit();
for (int i = 0; i < entries.length; i++) {
// items[i].id = result[i];
_fireChangeListners(EntryChangeType.Modification, entries[i]);
}
} catch (e) {
return;
}
}