Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
scan_result_item Class Reference

#include <couchbase/scan_result_item.hxx>

Inheritance diagram for scan_result_item:
Inheritance graph

Public Member Functions

 scan_result_item ()=default
 Constructs an empty scan_result_item.
 
 scan_result_item (std::string id, couchbase::cas cas, codec::encoded_value value, std::optional< std::chrono::system_clock::time_point > expiry_time)
 Constructs an instance representing a single item from the result of a scan operation.
 
 scan_result_item (std::string id)
 Constructs an instance representing a single item from the result of an id-only scan operation.
 
bool operator== (const scan_result_item &other) const
 
auto id () const -> const std::string &
 Returns the ID of the document.
 
auto id_only () const -> bool
 Returns whether this scan result item only contains the document ID.
 
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 the 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.
 
- Public Member Functions inherited from result
 result ()=default
 
 result (couchbase::cas cas)
 
auto cas () const -> couchbase::cas
 

Constructor & Destructor Documentation

◆ scan_result_item() [1/3]

scan_result_item ( )
default

Constructs an empty scan_result_item.

Since
1.0.0
Internal
Internal interface

◆ scan_result_item() [2/3]

scan_result_item ( std::string id,
couchbase::cas cas,
codec::encoded_value value,
std::optional< std::chrono::system_clock::time_point > expiry_time )
inline

Constructs an instance representing a single item from the result of a scan operation.

Parameters
idthe document ID
cas
valueraw document contents along with flags describing its structure
expiry_timeoptional point in time when the document will expire
Since
1.0.0
Internal
Internal interface

◆ scan_result_item() [3/3]

scan_result_item ( std::string id)
inlineexplicit

Constructs an instance representing a single item from the result of an id-only scan operation.

Parameters
idthe document ID
Since
1.0.0
Internal
Internal interface

Member Function Documentation

◆ content_as()

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 the content of the document using given codec.

Note
This method always returns an empty std::optional unless the collection#scan() request was made using scan_options#ids_only() set to false.
Template Parameters
Documentcustom type that Transcoder returns
Transcodertype 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

◆ 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#scan() request was made using scan_options#ids_only() set to false.
Returns
expiry time if present
Since
1.0.0
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ id()

auto id ( ) const -> const std::string&
inlinenodiscard

Returns the ID of the document.

Returns
document id
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ id_only()

auto id_only ( ) const -> bool
inlinenodiscard

Returns whether this scan result item only contains the document ID.

If true, accessing the content or CAS will return the default values.

Returns
whether this item comes from an id-only scan.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ operator==()

bool operator== ( const scan_result_item & other) const
inline

The documentation for this class was generated from the following file: