saveOnTransaction method
void
saveOnTransaction(
- ModelTransactionRef ref,
- ModelAdapterDocumentQuery query,
- DynamicMap value
override
Describes the data storage process when performing a transaction.
The ModelTransactionRef created by runTransaction is passed to ref
and the query of the target document is passed to query
.
The data to be stored is passed to value
.
Keys with value
value of null
should be deleted from the database.
トランザクションを行う際のデータ保存処理を記述します。
ref
にrunTransactionで作成したModelTransactionRefが渡され、query
は対象のドキュメントのクエリが渡されます。
value
に保存するデータが渡されます。
value
の値にNullが入っているキーはデータベース上から削除するようにしてください。
Implementation
@override
void saveOnTransaction(
ModelTransactionRef ref,
ModelAdapterDocumentQuery query,
DynamicMap value,
) {
_assert();
if (ref is! LocalModelTransactionRef) {
throw Exception("[ref] is not [LocalModelTransactionRef].");
}
ref._transactionList.add(() => saveDocument(query, value));
}