Represents result of collection::get.
More...
#include <couchbase/get_result.hxx>
|
| get_result ()=default |
|
| get_result (couchbase::cas cas, codec::encoded_value value, std::optional< std::chrono::system_clock::time_point > expiry_time) |
| Constructs result for get operation.
|
|
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.
|
|
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 codec.
|
|
auto | expiry_time () const -> const std::optional< std::chrono::system_clock::time_point > & |
| If the document has an expiry, returns the point in time when the loaded document expires.
|
|
| result ()=default |
|
| result (couchbase::cas cas) |
|
auto | cas () const -> couchbase::cas |
|
Represents result of collection::get.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ get_result() [1/2]
◆ get_result() [2/2]
Constructs result for get operation.
- Parameters
-
cas | |
value | raw document contents along with flags describing its structure |
expiry_time | optional point in time when the document will expire |
- 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 codec.
- Template Parameters
-
Transcoder | type that has static function decode that takes codec::encoded_value and returns Transcoder::value_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
◆ expiry_time()
auto expiry_time |
( |
| ) |
const -> const std::optional<std::chrono::system_clock::time_point>&
|
|
inlinenodiscard |
If the document has an expiry, returns the point in time when the loaded document expires.
- Note
- This method always returns an empty
std::optional
unless the collection#get()
request was made using get_options#with_expiry()
set to true.
- Returns
- expiry time if present
- 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: