39#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
42template<
typename Value>
43std::vector<std::vector<std::byte>>
44encode_array(
const Value& value)
49template<
typename Value>
50std::vector<std::vector<std::byte>>
51encode_array(std::vector<std::vector<std::byte>>&& output,
const Value& value)
54 return std::move(output);
57template<
typename Value,
typename... Rest>
58std::vector<std::vector<std::byte>>
59encode_array(std::vector<std::vector<std::byte>>&& output,
const Value& value, Rest... args)
62 return encode_array(std::move(output), args...);
65template<
typename Value,
typename... Rest>
66std::vector<std::vector<std::byte>>
67encode_array(
const Value& value, Rest... args)
69 return encode_array(encode_array(value), args...);
80 template<
typename... Operation>
99 template<
typename Value>
119 return { std::move(path), value };
139 std::vector<std::byte> value,
142 return { std::move(path), std::move(value), expand_macro };
157 template<
typename Value>
178 return { std::move(path), value };
197 std::vector<std::byte> value,
200 return { std::move(path), std::move(value), expand_macro };
231 template<
typename Value>
252 return { std::move(path), value };
271 std::vector<std::byte> value,
274 return { std::move(path), std::move(value), expand_macro };
293 "only positive delta allowed in subdoc increment, given: " +
294 std::to_string(delta));
296 return { std::move(path), delta };
313 "only positive delta allowed in subdoc decrement, given: " +
314 std::to_string(delta));
316 return { std::move(path), -1 * delta };
331 template<
typename... Values>
334 return { std::move(path), encode_array(values...) };
354 return { std::move(path), { std::move(values) } };
369 template<
typename... Values>
372 return { std::move(path), encode_array(values...) };
392 return { std::move(path), { std::move(values) } };
408 template<
typename... Values>
411 return { std::move(path), encode_array(values...) };
432 return { std::move(path), { std::move(values) } };
449 template<
typename Value>
473 return { std::move(path), value };
494 std::vector<std::byte> value,
497 return { std::move(path), std::move(value), expand_macro };
509 template<
typename Operation>
512 operation.encode(bundle());
526 template<
typename Operation,
typename... Rest>
527 void push_back(
const Operation& operation, Rest... args)
540 [[nodiscard]]
auto specs() const -> const std::vector<core::impl::subdoc::command>&;
543 [[nodiscard]] auto bundle() -> core::impl::subdoc::command_bundle&;
545 std::shared_ptr<core::impl::subdoc::command_bundle> specs_{};
static auto encode(Document document) -> encoded_value
Definition json_transcoder.hxx:33
Definition mutate_in_specs.hxx:76
void push_back(const Operation &operation)
Add subdocument operation to list of specs.
Definition mutate_in_specs.hxx:510
static auto increment(std::string path, std::int64_t delta) -> subdoc::counter
Creates a command with the intent of incrementing a numerical field in a JSON object.
Definition mutate_in_specs.hxx:289
static auto remove(std::string path) -> subdoc::remove
Creates a command with the intention of removing an existing value in a JSON object.
Definition mutate_in_specs.hxx:214
void push_back(const Operation &operation, Rest... args)
Add subdocument operations to list of specs.
Definition mutate_in_specs.hxx:527
static auto insert(std::string path, const Value &value) -> subdoc::insert
Creates a command with the intention of inserting a new value in a JSON object.
Definition mutate_in_specs.hxx:158
static auto upsert_raw(std::string path, std::vector< std::byte > value, bool expand_macro=false) -> subdoc::upsert
Creates a command with the intention of upserting a value in a JSON object.
Definition mutate_in_specs.hxx:270
static auto array_append_raw(std::string path, std::vector< std::byte > values) -> subdoc::array_append
Creates a command with the intention of appending a value to an existing JSON array.
Definition mutate_in_specs.hxx:351
static auto upsert(std::string path, const Value &value) -> subdoc::upsert
Creates a command with the intention of upserting a value in a JSON object.
Definition mutate_in_specs.hxx:232
static auto insert_raw(std::string path, std::vector< std::byte > value, bool expand_macro=false) -> subdoc::insert
Creates a command with the intention of inserting a new value in a JSON object.
Definition mutate_in_specs.hxx:196
static auto array_add_unique_raw(std::string path, std::vector< std::byte > value, bool expand_macro=false) -> subdoc::array_add_unique
Creates a command with the intent of inserting a value into an existing JSON array,...
Definition mutate_in_specs.hxx:493
static auto replace(std::string path, const Value &value) -> subdoc::replace
Creates a spec with the intention of replacing an existing value in a JSON document.
Definition mutate_in_specs.hxx:100
auto specs() const -> const std::vector< core::impl::subdoc::command > &
Returns internal representation of the specs.
mutate_in_specs()=default
mutate_in_specs(Operation... args)
Definition mutate_in_specs.hxx:81
static auto array_insert_raw(std::string path, std::vector< std::byte > values) -> subdoc::array_insert
Creates a command with the intention of inserting a value into an existing JSON array.
Definition mutate_in_specs.hxx:429
static auto array_add_unique(std::string path, subdoc::mutate_in_macro value) -> subdoc::array_add_unique
Creates a command with the intent of inserting a value into an existing JSON array,...
Definition mutate_in_specs.hxx:470
static auto array_prepend_raw(std::string path, std::vector< std::byte > values) -> subdoc::array_prepend
Creates a command with the intention of prepending a value to an existing JSON array.
Definition mutate_in_specs.hxx:389
static auto array_append(std::string path, Values... values) -> subdoc::array_append
Creates a command with the intention of appending a value to an existing JSON array.
Definition mutate_in_specs.hxx:332
static auto replace_raw(std::string path, std::vector< std::byte > value, bool expand_macro=false) -> subdoc::replace
Creates a spec with the intention of replacing an existing value in a JSON document.
Definition mutate_in_specs.hxx:138
static auto upsert(std::string path, subdoc::mutate_in_macro value) -> subdoc::upsert
Creates a command with the intention of upserting a value in a JSON object.
Definition mutate_in_specs.hxx:250
static auto insert(std::string path, subdoc::mutate_in_macro value) -> subdoc::insert
Creates a command with the intention of inserting a new value in a JSON object.
Definition mutate_in_specs.hxx:176
static auto array_insert(std::string path, Values... values) -> subdoc::array_insert
Creates a command with the intention of inserting a value into an existing JSON array.
Definition mutate_in_specs.hxx:409
static auto array_add_unique(std::string path, const Value &value) -> subdoc::array_add_unique
Creates a command with the intent of inserting a value into an existing JSON array,...
Definition mutate_in_specs.hxx:450
static auto replace(std::string path, subdoc::mutate_in_macro value) -> subdoc::replace
Creates a spec with the intention of replacing an existing value in a JSON document.
Definition mutate_in_specs.hxx:117
static auto array_prepend(std::string path, Values... values) -> subdoc::array_prepend
Creates a command with the intention of prepending a value to an existing JSON array.
Definition mutate_in_specs.hxx:370
static auto decrement(std::string path, std::int64_t delta) -> subdoc::counter
Creates a command with the intent of decrementing a numerical field in a JSON object.
Definition mutate_in_specs.hxx:309
An intention to perform a SubDocument array_add_unique operation.
Definition array_add_unique.hxx:41
An intention to perform a SubDocument array_append operation.
Definition array_append.hxx:41
An intention to perform a SubDocument array_insert operation.
Definition array_insert.hxx:41
An intention to perform a SubDocument array_prepend operation.
Definition array_prepend.hxx:41
An intention to perform a SubDocument counter operation.
Definition counter.hxx:39
An intention to perform a SubDocument insert operation.
Definition insert.hxx:41
An intention to perform a SubDocument remove operation.
Definition remove.hxx:39
An intention to perform a SubDocument replace operation.
Definition replace.hxx:41
An intention to perform a SubDocument upsert operation.
Definition upsert.hxx:41
@ invalid_argument
It is unambiguously determined that the error was caused because of invalid arguments from the user.
mutate_in_macro
Definition mutate_in_macro.hxx:29
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28