diff options
author | zxu <zxu@google.com> | 2018-04-12 21:32:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 21:32:19 -0400 |
commit | 2ceea9b66eb8ea516702e1ef409e801fec068682 (patch) | |
tree | 31de20fc11306df23b41f373c3768c03f2185359 /Firestore/Example/Tests/Util | |
parent | ac969c721a129e888177756fa2a6ae52af0dd04a (diff) |
Port `Precondition` to C++ (#1040)
* port FieldMask to C++
* address changes
* address changes
* fix test
* address change
* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++
* address changes
* address changes
* address changes
* implement `FieldTransform` in C++
* port `FieldTransform`
* make `fieldTransforms` shared inside `context`
* Implement Precondition in C++ w/o test yet
* add unit test for `Precondition`
* port `Precondition`
* address changes
* address changes
* fix bugs for integration test
* address changes
* fix lint
* address changes
* address changes
Diffstat (limited to 'Firestore/Example/Tests/Util')
-rw-r--r-- | Firestore/Example/Tests/Util/FSTHelpers.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Firestore/Example/Tests/Util/FSTHelpers.mm b/Firestore/Example/Tests/Util/FSTHelpers.mm index 2e1082e..78b41a4 100644 --- a/Firestore/Example/Tests/Util/FSTHelpers.mm +++ b/Firestore/Example/Tests/Util/FSTHelpers.mm @@ -48,6 +48,7 @@ #include "Firestore/core/src/firebase/firestore/model/field_mask.h" #include "Firestore/core/src/firebase/firestore/model/field_transform.h" #include "Firestore/core/src/firebase/firestore/model/field_value.h" +#include "Firestore/core/src/firebase/firestore/model/precondition.h" #include "Firestore/core/src/firebase/firestore/model/resource_path.h" #include "Firestore/core/src/firebase/firestore/model/transform_operations.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" @@ -62,6 +63,7 @@ using firebase::firestore::model::FieldMask; using firebase::firestore::model::FieldPath; using firebase::firestore::model::FieldTransform; using firebase::firestore::model::FieldValue; +using firebase::firestore::model::Precondition; using firebase::firestore::model::ResourcePath; using firebase::firestore::model::ServerTimestampTransform; using firebase::firestore::model::TransformOperation; @@ -250,7 +252,7 @@ FSTDocumentSet *FSTTestDocSet(NSComparator comp, NSArray<FSTDocument *> *docs) { FSTSetMutation *FSTTestSetMutation(NSString *path, NSDictionary<NSString *, id> *values) { return [[FSTSetMutation alloc] initWithKey:FSTTestDocKey(path) value:FSTTestObjectValue(values) - precondition:[FSTPrecondition none]]; + precondition:Precondition::None()]; } FSTPatchMutation *FSTTestPatchMutation(const absl::string_view path, @@ -274,7 +276,7 @@ FSTPatchMutation *FSTTestPatchMutation(const absl::string_view path, return [[FSTPatchMutation alloc] initWithKey:key fieldMask:mask value:objectValue - precondition:[FSTPrecondition preconditionWithExists:YES]]; + precondition:Precondition::Exists(true)]; } // For now this only creates TransformMutations with server timestamps. @@ -291,8 +293,8 @@ FSTTransformMutation *FSTTestTransformMutation(NSString *path, } FSTDeleteMutation *FSTTestDeleteMutation(NSString *path) { - return [[FSTDeleteMutation alloc] initWithKey:FSTTestDocKey(path) - precondition:[FSTPrecondition none]]; + return + [[FSTDeleteMutation alloc] initWithKey:FSTTestDocKey(path) precondition:Precondition::None()]; } FSTMaybeDocumentDictionary *FSTTestDocUpdates(NSArray<FSTMaybeDocument *> *docs) { |