saveMany method
Future<int>
saveMany({
- required List<
T> entities, - Database? database,
- int? chunk,
- required MergeMode mergeMode,
- SaveOptions? saveOptions,
override
Implementation
@override
Future<int> saveMany(
{required List<T> entities,
Database? database,
int? chunk,
required MergeMode mergeMode,
SaveOptions? saveOptions}) async {
final Database db = database != null ? database : this.database;
if (entities.isEmpty) {
return 1;
}
final queue = Queue(parallel: chunk ?? 500);
entities.forEach((T entity) {
queue.add(() => saveOne(
entity: entity,
database: db,
mergeMode: mergeMode,
saveOptions: saveOptions));
});
await queue.onComplete;
return 1;
}