#include <userver/storages/postgres/result_set.hpp>
PostgreSQL result set.
Provides random access to rows via indexing operations and bidirectional iteration via iterators.
Usage synopsis
auto trx = ...;
auto res = trx.Execute("select a, b from table");
for (auto row : res) {
}
- Examples
- samples/digest_auth_service/auth_digest.cpp, and samples/postgres_service/postgres_service.cpp.
Definition at line 600 of file result_set.hpp.
|
static constexpr size_type | npos = std::numeric_limits<size_type>::max() |
|
|
template<typename T , typename Tag > |
class | TypedResultSet |
|
class | ConnectionImpl |
|
template<typename T > |
auto | AsSetOf () const |
| Get a wrapper for iterating over a set of typed results. For more information see psql_typed_results.
|
|
template<typename T > |
auto | AsSetOf (RowTag) const |
|
template<typename T > |
auto | AsSetOf (FieldTag) const |
|
template<typename Container > |
Container | AsContainer () const |
| Extract data into a container. For more information see psql_typed_results.
|
|
template<typename Container > |
Container | AsContainer (RowTag) const |
|
template<typename T > |
auto | AsSingleRow () const |
| Extract first row into user type. A single row result set is expected, will throw an exception when result set size != 1.
|
|
template<typename T > |
auto | AsSingleRow (RowTag) const |
|
template<typename T > |
auto | AsSingleRow (FieldTag) const |
|
template<typename T > |
std::optional< T > | AsOptionalSingleRow () const |
| Extract first row into user type.
|
|
template<typename T > |
std::optional< T > | AsOptionalSingleRow (RowTag) const |
|
template<typename T > |
std::optional< T > | AsOptionalSingleRow (FieldTag) const |
|
◆ const_iterator
◆ const_reverse_iterator
◆ difference_type
using storages::postgres::ResultSet::difference_type = std::ptrdiff_t |
◆ pointer
◆ reference
◆ size_type
using storages::postgres::ResultSet::size_type = std::size_t |
◆ value_type
◆ ResultSet()
storages::postgres::ResultSet::ResultSet |
( |
std::shared_ptr< detail::ResultWrapper > | pimpl | ) |
|
|
inlineexplicit |
◆ AsContainer() [1/2]
template<typename Container >
Container storages::postgres::ResultSet::AsContainer |
( |
| ) |
const |
Extract data into a container. For more information see psql_typed_results.
Definition at line 980 of file result_set.hpp.
◆ AsContainer() [2/2]
template<typename Container >
Container storages::postgres::ResultSet::AsContainer |
( |
RowTag | | ) |
const |
◆ AsOptionalSingleRow() [1/3]
template<typename T >
std::optional< T > storages::postgres::ResultSet::AsOptionalSingleRow |
( |
| ) |
const |
Extract first row into user type.
- Returns
- A single row result set if non empty result was returned, empty std::optional otherwise
- Exceptions
-
exception | when result set size > 1 |
Definition at line 1041 of file result_set.hpp.
◆ AsOptionalSingleRow() [2/3]
template<typename T >
std::optional< T > storages::postgres::ResultSet::AsOptionalSingleRow |
( |
FieldTag | | ) |
const |
◆ AsOptionalSingleRow() [3/3]
template<typename T >
std::optional< T > storages::postgres::ResultSet::AsOptionalSingleRow |
( |
RowTag | | ) |
const |
◆ AsSetOf() [1/3]
template<typename T >
auto storages::postgres::ResultSet::AsSetOf |
( |
| ) |
const |
Get a wrapper for iterating over a set of typed results. For more information see psql_typed_results.
Definition at line 955 of file result_set.hpp.
◆ AsSetOf() [2/3]
template<typename T >
auto storages::postgres::ResultSet::AsSetOf |
( |
FieldTag | | ) |
const |
◆ AsSetOf() [3/3]
template<typename T >
auto storages::postgres::ResultSet::AsSetOf |
( |
RowTag | | ) |
const |
◆ AsSingleRow() [1/3]
template<typename T >
auto storages::postgres::ResultSet::AsSingleRow |
( |
| ) |
const |
◆ AsSingleRow() [2/3]
template<typename T >
auto storages::postgres::ResultSet::AsSingleRow |
( |
FieldTag | | ) |
const |
◆ AsSingleRow() [3/3]
template<typename T >
auto storages::postgres::ResultSet::AsSingleRow |
( |
RowTag | | ) |
const |
◆ begin()
◆ end()
◆ GetRowDescription()
RowDescription storages::postgres::ResultSet::GetRowDescription |
( |
| ) |
const & |
|
inline |
◆ IsEmpty()
bool storages::postgres::ResultSet::IsEmpty |
( |
| ) |
const |
|
inline |
◆ operator[]()
reference storages::postgres::ResultSet::operator[] |
( |
size_type | index | ) |
const & |
Access a row by index.
- Exceptions
-
◆ rbegin()
◆ rend()
◆ ConnectionImpl
friend class ConnectionImpl |
|
friend |
◆ TypedResultSet
template<typename T , typename Tag >
◆ npos
constexpr size_type storages::postgres::ResultSet::npos = std::numeric_limits<size_type>::max() |
|
staticconstexpr |
The documentation for this class was generated from the following file: