Couchbase C++ SDK
1.4.0 (rev. 59aa900)
Toggle main menu visibility
Loading...
Searching...
No Matches
transaction_get_result.hxx
Go to the documentation of this file.
1
/*
2
* Copyright 2021-Present Couchbase, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#pragma once
17
18
#include <string>
19
20
#include <
couchbase/cas.hxx
>
21
#include <
couchbase/codec/lenient_json_transcoder.hxx
>
22
#include <
couchbase/collection.hxx
>
23
#include <
couchbase/result.hxx
>
24
25
// forward declarations...
26
namespace
couchbase::core::transactions
27
{
28
class
attempt_context_impl;
29
class
transaction_get_result;
30
class
transaction_links;
31
class
document_metadata;
32
}
// namespace couchbase::core::transactions
33
34
namespace
couchbase::transactions
35
{
56
class
transaction_get_result
57
{
58
public
:
62
transaction_get_result
();
63
72
template
<
typename
Document, std::enable_if_t<!codec::is_transcoder_v<Document>,
bool
> = true>
73
[[nodiscard]]
auto
content_as
() const -> Document
74
{
75
return
codec::default_lenient_json_transcoder::decode<Document>
(content());
76
}
77
83
template
<
typename
Document,
84
typename
Transcoder,
85
std::enable_if_t<!codec::is_transcoder_v<Document>,
bool
> =
true
,
86
std::enable_if_t<codec::is_transcoder_v<Transcoder>,
bool
> =
true
>
87
[[nodiscard]]
auto
content_as
() const -> Document
88
{
89
return
Transcoder::template decode<Document>(content());
90
}
91
97
template
<
typename
Transcoder, std::enable_if_t<codec::is_transcoder_v<Transcoder>,
bool
> = true>
98
[[nodiscard]]
auto
content_as
() const -> typename Transcoder::document_type
99
{
100
return
Transcoder::decode(content());
101
}
102
108
[[nodiscard]]
auto
id
() const -> const std::
string
&;
109
110
private:
111
std::shared_ptr<
couchbase
::
core
::
transactions
::
transaction_get_result
> base_{};
112
113
explicit
transaction_get_result
(
114
std::shared_ptr<couchbase::core::transactions::transaction_get_result> base)
115
: base_(std::move(base))
116
{
117
}
118
119
[[nodiscard]]
auto
content() const -> const
codec
::encoded_value&;
120
121
friend class
couchbase
::
core
::
transactions
::
transaction_get_result
;
122
friend class
couchbase
::
core
::
transactions
::
attempt_context_impl
;
123
124
[[nodiscard]] auto bucket() const -> const std::
string
&;
125
[[nodiscard]] auto scope() const -> const std::
string
&;
126
[[nodiscard]] auto collection() const -> const std::
string
&;
127
[[nodiscard]] auto cas() const ->
couchbase
::cas;
128
};
129
}
// namespace couchbase::transactions
cas.hxx
couchbase::codec::lenient_json_transcoder< tao_json_serializer >::decode
static auto decode(const encoded_value &encoded) -> Document
Definition
lenient_json_transcoder.hxx:56
couchbase::transactions::transaction_get_result::content_as
auto content_as() const -> typename Transcoder::document_type
Content of the document, decoded with the given transcoder.
Definition
transaction_get_result.hxx:98
couchbase::transactions::transaction_get_result::content_as
auto content_as() const -> Document
Content of the document.
Definition
transaction_get_result.hxx:73
couchbase::transactions::transaction_get_result::id
auto id() const -> const std::string &
Get document id.
couchbase::transactions::transaction_get_result::attempt_context_impl
friend class couchbase::core::transactions::attempt_context_impl
Definition
transaction_get_result.hxx:122
couchbase::transactions::transaction_get_result::transaction_get_result
friend class couchbase::core::transactions::transaction_get_result
Definition
transaction_get_result.hxx:121
couchbase::transactions::transaction_get_result::content_as
auto content_as() const -> Document
Content of the document, decoded with the given transcoder.
Definition
transaction_get_result.hxx:87
couchbase::transactions::transactions
The transactions object is used to initiate a transaction.
Definition
transactions.hxx:52
collection.hxx
lenient_json_transcoder.hxx
couchbase::codec
Definition
analytics_options.hxx:36
couchbase::core::transactions
Definition
transaction_get_multi_options.hxx:23
couchbase::core
Definition
expiry.hxx:24
couchbase::transactions
Definition
transactions.hxx:43
couchbase
Represents a single item from the result of scan().
Definition
allow_querying_search_index_options.hxx:28
result.hxx
couchbase
transactions
transaction_get_result.hxx
Generated by
1.17.0