Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::database::ResultSet Class Reference

Represents a generic, unified result set from a database query. More...

#include <ResultSet.hpp>

Public Member Functions

 ResultSet ()=default
 
 ResultSet (std::vector< Row > rows, uint64_t affected_rows=0)
 
bool ok () const
 False if the query failed; error() then says why.
 
const std::string & error () const
 
const std::vector< Row > & rows () const
 
size_t size () const
 
bool empty () const
 
uint64_t affected_rows () const
 
const Row & operator[] (size_t index) const
 
nlohmann::json to_json () const
 Serializes the entire result set to a JSON array of objects.
 

Static Public Member Functions

static ResultSet failure (std::string message)
 A result describing a failed query.
 

Private Attributes

std::vector< Row > rows_
 
uint64_t affected_rows_ {0}
 
std::string error_
 

Detailed Description

Represents a generic, unified result set from a database query.

Constructor & Destructor Documentation

◆ ResultSet() [1/2]

orbit::database::ResultSet::ResultSet ( )
default

◆ ResultSet() [2/2]

orbit::database::ResultSet::ResultSet ( std::vector< Row >  rows,
uint64_t  affected_rows = 0 
)
inline

Member Function Documentation

◆ affected_rows()

uint64_t orbit::database::ResultSet::affected_rows ( ) const
inline

◆ empty()

bool orbit::database::ResultSet::empty ( ) const
inline

◆ error()

const std::string & orbit::database::ResultSet::error ( ) const
inline

◆ failure()

static ResultSet orbit::database::ResultSet::failure ( std::string  message)
inlinestatic

A result describing a failed query.

◆ ok()

bool orbit::database::ResultSet::ok ( ) const
inline

False if the query failed; error() then says why.

◆ operator[]()

const Row & orbit::database::ResultSet::operator[] ( size_t  index) const
inline

◆ rows()

const std::vector< Row > & orbit::database::ResultSet::rows ( ) const
inline

◆ size()

size_t orbit::database::ResultSet::size ( ) const
inline

◆ to_json()

nlohmann::json orbit::database::ResultSet::to_json ( ) const
inline

Serializes the entire result set to a JSON array of objects.

Member Data Documentation

◆ affected_rows_

uint64_t orbit::database::ResultSet::affected_rows_ {0}
private

◆ error_

std::string orbit::database::ResultSet::error_
private

◆ rows_

std::vector<Row> orbit::database::ResultSet::rows_
private

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