ModelBatchDocumentBuilder<T> class
Builder for batch processing.
ModelBatchDocument can be created from other DocumentBase using ModelBatchRef.read, and the process to be executed together can be written.
Batch processing can be performed by executing ModelBatchDocument.save and ModelBatchDocument.delete using ModelBatchDocument.
Data integrity is not protected and processing occurs in parallel.
If splitLength is specified, batch processing can be split and executed for each splitLength. /// If there is a fixed limit to the number of batch processes that can be executed at one time, such as in a Firestore, you can specify this number to limit the number of batch processes to be executed at one time.
バッチ処理を行うためのビルダー。
ModelBatchRef.readを用いて他のDocumentBaseからModelBatchDocumentを作成することができ、まとめて実行する処理を記述することができます。
ModelBatchDocumentを用いてModelBatchDocument.save、ModelBatchDocument.deleteを実行することでバッチ処理を行うことが可能です。
データの整合性は守られず、並列で処理が行われます。
splitLengthを指定すると、バッチ処理をsplitLengthごとに分割して実行することができます。 Firestoreなどの一度のバッチ処理の上限が決められている場合、この数を指定して1度に実行するバッチ処理の数を抑えることができます。
final batch = sourceDocument.batch();
batch((ref, document){
final doc = ref.read(document); // `doc` is [ModelBatchDocument] of `sourceDocument`.
final newValue = {"name": "test"}; // The same mechanism can be used to perform the same preservation method as usual.
doc.save(newValue);
});
Properties
-
document
→ DocumentBase<
T> -
Original document.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- splitLength → int
-
Number of batch processes to be divided.
final
Methods
-
call(
FutureOr< void> batch(ModelBatchRef ref, DocumentBase<T> doc)) → FutureOr<void> -
Pass
batch
as a callback to execute the batch. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited