userver: storages::postgres::Field Class Reference
Loading...
Searching...
No Matches
storages::postgres::Field Class Reference

#include <userver/storages/postgres/result_set.hpp>

Detailed Description

Accessor to a single field in a result set's row.

Definition at line 293 of file result_set.hpp.

+ Inheritance diagram for storages::postgres::Field:

Public Types

using size_type = std::size_t
 

Public Member Functions

size_type RowIndex () const
 
size_type FieldIndex () const
 
Field metadata
std::string_view Name () const
 Field name as named in query.
 
FieldDescription Description () const
 
Oid GetTypeOid () const
 

Data access

class Row
 
bool IsNull () const
 
template<typename T >
size_type To (T &&val) const
 
template<typename T >
void Coalesce (T &val, const T &default_val) const
 
template<typename T >
std::decay< T >::type As () const
 
template<typename T >
std::decay< T >::type Coalesce (const T &default_val) const
 
const io::TypeBufferCategory & GetTypeBufferCategories () const
 
 Field (detail::ResultWrapperPtr res, size_type row, size_type col)
 

Iteration support

bool IsValid () const
 
int Compare (const Field &rhs) const
 
std::ptrdiff_t Distance (const Field &rhs) const
 
FieldAdvance (std::ptrdiff_t)
 

Member Typedef Documentation

◆ size_type

using storages::postgres::Field::size_type = std::size_t

Definition at line 295 of file result_set.hpp.

Constructor & Destructor Documentation

◆ Field()

storages::postgres::Field::Field ( detail::ResultWrapperPtr res,
size_type row,
size_type col )
inlineprotected

Definition at line 354 of file result_set.hpp.

Member Function Documentation

◆ As()

template<typename T >
std::decay< T >::type storages::postgres::Field::As ( ) const
inline

Convert the field's buffer into a C++ type.

Exceptions
FieldValueIsNullIf the field is null and the C++ type is not nullable.

Definition at line 335 of file result_set.hpp.

◆ Coalesce() [1/2]

template<typename T >
std::decay< T >::type storages::postgres::Field::Coalesce ( const T & default_val) const
inline

Convert the field's buffer into a C++ type. If the field is null, return default value.

Definition at line 344 of file result_set.hpp.

◆ Coalesce() [2/2]

template<typename T >
void storages::postgres::Field::Coalesce ( T & val,
const T & default_val ) const
inline

Read the field's buffer into user-provided variable. If the field is null, set the variable to the default value.

Definition at line 324 of file result_set.hpp.

◆ FieldIndex()

size_type storages::postgres::Field::FieldIndex ( ) const
inline

Definition at line 298 of file result_set.hpp.

◆ RowIndex()

size_type storages::postgres::Field::RowIndex ( ) const
inline

Definition at line 297 of file result_set.hpp.

◆ To()

template<typename T >
size_type storages::postgres::Field::To ( T && val) const
inline

Read the field's buffer into user-provided variable.

Exceptions
FieldValueIsNullIf the field is null and the C++ type is not nullable.

Definition at line 317 of file result_set.hpp.

Friends And Related Symbol Documentation

◆ Row

friend class Row
friend

Definition at line 352 of file result_set.hpp.


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