40#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
43template<
typename Value>
45encode_array(
const Value& value) -> std::vector<std::vector<std::byte>>
50template<
typename Value>
52encode_array(std::vector<std::vector<std::byte>>&& output,
53 const Value& value) -> std::vector<std::vector<std::byte>>
56 return std::move(output);
59template<
typename Value,
typename... Rest>
61encode_array(std::vector<std::vector<std::byte>>&& output,
63 Rest... args) -> std::vector<std::vector<std::byte>>
66 return encode_array(std::move(output), args...);
69template<
typename Value,
typename... Rest>
71encode_array(
const Value& value, Rest... args) -> std::vector<std::vector<std::byte>>
73 return encode_array(encode_array(value), args...);
84 template<
typename... Operation>
103 template<
typename Value>
123 return { std::move(path), value };
143 std::vector<std::byte> value,
146 return { std::move(path), std::move(value), expand_macro };
161 template<
typename Value>
182 return { std::move(path), value };
201 std::vector<std::byte> value,
204 return { std::move(path), std::move(value), expand_macro };
235 template<
typename Value,
typename Transcoder = codec::default_json_transcoder>
238 return { std::move(path), std::move(Transcoder::template encode<const Value&>(value).data) };
256 return { std::move(path), value };
275 std::vector<std::byte> value,
278 return { std::move(path), std::move(value), expand_macro };
297 "only positive delta allowed in subdoc increment, given: " +
298 std::to_string(delta));
300 return { std::move(path), delta };
317 "only positive delta allowed in subdoc decrement, given: " +
318 std::to_string(delta));
320 return { std::move(path), -1 * delta };
335 template<
typename... Values>
338 return { std::move(path), encode_array(values...) };
358 return { std::move(path), { std::move(values) } };
373 template<
typename... Values>
376 return { std::move(path), encode_array(values...) };
396 return { std::move(path), { std::move(values) } };
412 template<
typename... Values>
415 return { std::move(path), encode_array(values...) };
436 return { std::move(path), { std::move(values) } };
453 template<
typename Value,
typename Transcoder = codec::default_json_transcoder>
456 return { std::move(path), std::move(Transcoder::template encode<Value>(value).data) };
477 return { std::move(path), value };
498 std::vector<std::byte> value,
501 return { std::move(path), std::move(value), expand_macro };
513 template<
typename Operation>
516 operation.encode(bundle());
530 template<
typename Operation,
typename... Rest>
531 void push_back(
const Operation& operation, Rest... args)
544 [[nodiscard]]
auto specs() const -> const std::vector<core::impl::subdoc::command>&;
547 [[nodiscard]] auto bundle() -> core::impl::subdoc::command_bundle&;
549 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:80
void push_back(const Operation &operation)
Add subdocument operation to list of specs.
Definition mutate_in_specs.hxx:514
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:293
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:218
void push_back(const Operation &operation, Rest... args)
Add subdocument operations to list of specs.
Definition mutate_in_specs.hxx:531
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:162
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:274
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:355
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:200
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:497
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:104
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:85
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:433
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:454
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:474
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:393
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:336
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:142
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:236
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:254
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:180
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:413
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:121
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:374
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:313
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