83 template<
typename Document>
86 for (
const entry&
e : entries_) {
87 if (
e.original_index == index) {
89 throw std::system_error(
e.ec,
90 "error getting result for spec at index " +
91 std::to_string(index) +
", path \"" +
e.path +
"\"");
94 return codec::tao_json_serializer::deserialize<Document>(
e.value);
98 "invalid index for lookup_in result: {}" + std::to_string(index));
111 template<
typename Document>
114 for (
const entry&
e : entries_) {
115 if (
e.path == path) {
117 throw std::system_error(
e.ec,
"error getting result for path \"" +
e.path +
"\"");
120 return codec::tao_json_serializer::deserialize<Document>(
e.value);
124 "invalid path for lookup_in result: " + path);
137 template<
typename Document>
141 for (
const entry&
e : entries_) {
144 throw std::system_error(
e.ec,
"error getting result for macro \"" +
macro_string +
"\"");
147 return codec::tao_json_serializer::deserialize<Document>(
e.value);
151 "invalid path for lookup_in result: macro#" +
152 std::to_string(
static_cast<std::uint32_t
>(
macro)));
166 for (
const entry&
e : entries_) {
167 if (
e.original_index == index) {
169 throw std::system_error(
e.ec,
"error getting result for path \"" +
e.path +
"\"");
190 for (
const entry&
e : entries_) {
193 throw std::system_error(
e.ec,
"error getting result for macro \"" +
macro_string +
"\"");
213 for (
const entry&
e : entries_) {
214 if (
e.path == path) {
216 throw std::system_error(
e.ec,
"error getting result for path \"" +
e.path +
"\"");
253 for (
const entry&
e : entries_) {
254 if (
e.original_index == index) {
255 return !
e.value.empty();
259 "invalid index for mutate_in result: " + std::to_string(index));
273 for (
const entry&
e : entries_) {
274 if (
e.path == path) {
275 return !
e.value.empty();
279 "invalid path for mutate_in result: " + path);
283 std::vector<entry> entries_{};
284 bool is_deleted_{
false };
CAS is a special type that represented in protocol using unsigned 64-bit integer, but only equality c...
Definition cas.hxx:34
Represents result of lookup_in operations.
Definition lookup_in_result.hxx:36
auto exists(subdoc::lookup_in_macro macro) const -> bool
Allows to check if a value at the given index exists.
Definition lookup_in_result.hxx:187
lookup_in_result(couchbase::cas cas, std::vector< entry > entries, bool is_deleted)
Constructs result for lookup_in_result operation.
Definition lookup_in_result.hxx:66
auto exists(std::size_t index) const -> bool
Allows to check if a value at the given index exists.
Definition lookup_in_result.hxx:164
lookup_in_result()=default
auto has_value(const std::string &path) const -> bool
Returns whether the field has value.
Definition lookup_in_result.hxx:271
auto content_as(subdoc::lookup_in_macro macro) const -> Document
Decodes field of the document into type.
Definition lookup_in_result.hxx:138
auto content_as(const std::string &path) const -> Document
Decodes field of the document into type.
Definition lookup_in_result.hxx:112
auto has_value(std::size_t index) const -> bool
Returns whether the field has value.
Definition lookup_in_result.hxx:251
auto content_as(std::size_t index) const -> Document
Decodes field of the document into type.
Definition lookup_in_result.hxx:84
auto is_deleted() const -> bool
Returns whether this document was deleted (a tombstone).
Definition lookup_in_result.hxx:237
auto exists(const std::string &path) const -> bool
Allows to check if a value at the given index exists.
Definition lookup_in_result.hxx:211
Base class for operations of data service.
Definition result.hxx:32
std::vector< std::byte > binary
Definition encoded_value.hxx:25
@ path_not_found
The path provided for a sub-document operation was not found.
@ path_invalid
The path provided for a sub-document operation was not syntactically correct.
lookup_in_macro
Definition lookup_in_macro.hxx:29
auto to_string(lookup_in_macro value) -> std::string
Converts macro into binary array suitable for sending to the server.
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
Definition lookup_in_result.hxx:42
std::error_code ec
Definition lookup_in_result.hxx:47
std::string path
Definition lookup_in_result.hxx:43
codec::binary value
Definition lookup_in_result.hxx:44
std::size_t original_index
Definition lookup_in_result.hxx:45
bool exists
Definition lookup_in_result.hxx:46