Represents result of collection::get_any_replica operations, also returned by collection::get_all_replicas.
More...
#include <couchbase/get_replica_result.hxx>
|
| get_replica_result ()=default |
|
| get_replica_result (couchbase::cas cas, bool is_replica, codec::encoded_value value) |
| Constructs result for get_any_replica operation, or an entry for get_all_replicas operation.
|
|
auto | is_replica () const -> bool |
|
template<typename Transcoder , std::enable_if_t< codec::is_transcoder_v< Transcoder >, bool > = true> |
auto | content_as () const -> typename Transcoder::document_type |
| Decodes content of the document using given transcoder.
|
|
template<typename Document , typename Transcoder = codec::default_json_transcoder, std::enable_if_t<!codec::is_transcoder_v< Document >, bool > = true, std::enable_if_t< codec::is_transcoder_v< Transcoder >, bool > = true> |
auto | content_as () const -> Document |
| Decodes content of the document using given codec.
|
|
| result ()=default |
|
| result (couchbase::cas cas) |
|
auto | cas () const -> couchbase::cas |
|
Represents result of collection::get_any_replica operations, also returned by collection::get_all_replicas.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ get_replica_result() [1/2]
◆ get_replica_result() [2/2]
Constructs result for get_any_replica operation, or an entry for get_all_replicas operation.
- Parameters
-
cas | |
is_replica | true if the document originates from replica node |
value | raw document contents along with flags describing its structure |
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ content_as() [1/2]
template<typename Document , typename Transcoder = codec::default_json_transcoder, std::enable_if_t<!
codec::is_transcoder_v< Document >, bool > = true, std::enable_if_t<
codec::is_transcoder_v< Transcoder >, bool > = true>
auto content_as |
( |
| ) |
const -> Document
|
|
inlinenodiscard |
Decodes content of the document using given codec.
- Template Parameters
-
Document | custom type that Transcoder returns |
Transcoder | type that has static function decode that takes codec::encoded_value and returns Document |
- Returns
- decoded document content
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ content_as() [2/2]
auto content_as |
( |
| ) |
const -> typename Transcoder::document_type
|
|
inlinenodiscard |
Decodes content of the document using given transcoder.
- Template Parameters
-
Transcoder | type that has static function decode that takes codec::encoded_value and returns Transcoder::document_type |
- Returns
- decoded document content
- Get flags and value as they are stored in the result
- Here is an example of custom transcoder, that just extracts value and flags as they are stored in the result.
struct smuggling_transcoder {
using document_type = std::pair<std::vector<std::byte>, std::uint32_t>;
{
return { encoded.data, encoded.flags };
}
};
template<>
};
Usage
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ is_replica()
auto is_replica |
( |
| ) |
const -> bool
|
|
inlinenodiscard |
- Returns
- true if the document came from replica, false for active node.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
The documentation for this class was generated from the following file: