transaction method

ModelTransactionBuilder<NoteModel> transaction()
inherited

Create a transaction builder.

The invoked transaction can be call as is, and transaction processing can be performed by executing ModelTransactionDocument.load, ModelTransactionDocument.save, and ModelTransactionDocument.delete.

ModelTransactionRef.read] can be used to create a ModelTransactionDocument from another DocumentBase and describe the process to be performed together.

トランザクションビルダーを作成します。

呼び出されたトランザクションはそのままcallすることができ、その引数から与えられるModelTransactionDocumentを用いてModelTransactionDocument.loadModelTransactionDocument.saveModelTransactionDocument.deleteを実行することでトランザクション処理を行うことが可能です。

ModelTransactionRef.readを用いて他のDocumentBaseからModelTransactionDocumentを作成することができ、まとめて実行する処理を記述することができます。

final transaction = sourceDocument.transaction();
transaction((ref, doc){ // `doc`は`sourceDocument`の[ModelTransactionDocument]
  final newValue = {"name": "test"}; // The same mechanism can be used to perform the same preservation method as usual.
  doc.save(newValue);
});

Implementation

ModelTransactionBuilder<T> transaction() {
  return ModelTransactionBuilder._(this);
}