21 #include <couchbase/internal/nlohmann/json.hpp> 33 enum class mutate_in_spec_type { MUTATE_IN_UPSERT, MUTATE_IN_INSERT, MUTATE_IN_FULLDOC_INSERT, MUTATE_IN_FULLDOC_UPSERT, REMOVE };
42 namespace mutate_in_macro
45 static const std::string CAS =
"${Mutation.CAS}";
47 static const std::string SEQ_NO =
"${Mutation.seqno}";
49 static const std::string VALUE_CRC_32C =
"${Mutation.value_crc32c}";
77 template<
typename Content>
80 return mutate_in_spec(mutate_in_spec_type::MUTATE_IN_UPSERT, path, value);
92 template<
typename Content>
95 return mutate_in_spec(mutate_in_spec_type::MUTATE_IN_INSERT, path, value);
106 template<
typename Content>
109 return mutate_in_spec(mutate_in_spec_type::MUTATE_IN_FULLDOC_INSERT, value);
120 template<
typename Content>
123 return mutate_in_spec(mutate_in_spec_type::MUTATE_IN_FULLDOC_UPSERT, value);
134 return mutate_in_spec(mutate_in_spec_type::REMOVE, path, std::string(
""));
159 mutate_in_spec_type type_;
164 mutate_in_spec(mutate_in_spec_type type, std::string path,
const nlohmann::json& value)
166 , path_(
std::move(path))
167 , value_(value.dump())
171 mutate_in_spec(mutate_in_spec_type type,
const nlohmann::json& value)
174 , value_(value.dump())
Definition: bucket.hxx:33
mutate_in_spec & xattr()
Specify the mutation is on xattrs, rather than the document body.
static mutate_in_spec insert(const std::string &path, const Content &value)
Insert content at a path within a document.
Definition: mutate_in_spec.hxx:93
static mutate_in_spec upsert(const std::string &path, const Content &value)
Upsert content at a path within a document.
Definition: mutate_in_spec.hxx:78
mutate_in_spec & create_path()
Specify the mutation creates the entire path.
mutate_in_spec & expand_macro()
Specify the value in this mutation spec contains a mutate_in_macro.
static mutate_in_spec fulldoc_insert(const Content &value)
Inserts the content as the entire body of the document.
Definition: mutate_in_spec.hxx:107
Specify specific elements in a document to mutate.
Definition: mutate_in_spec.hxx:63
Exposes collection-level kv operations.
Definition: collection.hxx:46
static mutate_in_spec fulldoc_upsert(const Content &value)
Upsert the content as the entire body of the document.
Definition: mutate_in_spec.hxx:121