batchProcess method
Future<void>
batchProcess({})
inherited
Implementation
@override
Future<void> batchProcess({
required int batchSize,
required Future<void> Function(
List<Map<String, dynamic>> batch, int batchNumber)
processor,
List<String> columns = const ['*'],
}) async {
int batchNumber = 1;
int offset = 0;
while (true) {
final batchQuery = QueryBuilderImpl()
..table(getTable)
..select(columns)
..limit(batchSize)
..offset(offset);
final batch = await batchQuery.get();
if (batch.isEmpty) break;
await processor(batch, batchNumber);
if (batch.length < batchSize) break;
offset += batchSize;
batchNumber++;
}
}