ModelTransactionCollectionBuilder<TModel extends DocumentBase> class
Builder for transactions.
ModelTransactionDocument can be created from other DocumentBase using ModelTransactionRef.read, and the process to be executed together can be written.
ModelTransactionDocument.load, ModelTransactionDocument.save, and ModelTransactionDocument.delete using ModelTransactionDocument. transaction processing can be performed by executing
トランザクションを行うためのビルダー。
ModelTransactionRef.readを用いて他のDocumentBaseからModelTransactionDocumentを作成することができ、まとめて実行する処理を記述することができます。
ModelTransactionDocumentを用いてModelTransactionDocument.load、ModelTransactionDocument.save、ModelTransactionDocument.deleteを実行することでトランザクション処理を行うことが可能です。
final transaction = sourceCollection.transaction();
transaction((ref, collection){
final doc = ref.read(collection.create()); // `doc` is [ModelTransactionDocument] of `sourceDocument`.
final newValue = {"name": "test"}; // The same mechanism can be used to perform the same preservation method as usual.
doc.save(newValue);
});
- Available Extensions
Properties
-
collection
→ CollectionBase<
TModel> -
Original collection.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
FutureOr< void> transaction(ModelTransactionRef ref, CollectionBase<TModel> collection)) → FutureOr<void> -
transaction
is passed as a callback to execute the transaction. -
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