updateAll method
更新所有数据库
Implementation
@override
Future<int> updateAll(List<T>? t, {
String? tableName,
ConflictAlgorithm? conflictAlgorithm = ConflictAlgorithm.replace,
}) async {
if (t == null || t.isEmpty) return Future.value(-1);
final batch = db.batch();
for (T? c in t) {
if (c == null) continue;
Map<String, dynamic> values = c.toJson();
Map keyAndValues = c.primaryKeyAndValue();
_convertSafeMap(values);
batch.update(
tableName ?? table,
values,
conflictAlgorithm: conflictAlgorithm,
where: "${keyAndValues.keys.first} = ?",
whereArgs: [keyAndValues.values.first],
);
}
await batch.commit(noResult: true);
return Future.value(0);
}