OXY API 1.0
OXY API Library Documentation
Loading...
Searching...
No Matches
oxy::context::pull_fn Struct Reference

A function object that pulls rows from a database context as a coroutine, optionally filtering results and selecting specific columns. More...

#include <context.hpp>

Public Types

using coro_t = boost::coroutines2::coroutine<result_t>
using result_t = std::map<std::string, std::string>

Public Member Functions

auto operator() (context_t const &ctx, filter_t const &filter, std::string const &columns="*") const -> coro_t::pull_type
auto operator() (context_t const &ctx, std::string const &columns="*") const -> coro_t::pull_type

Detailed Description

A function object that pulls rows from a database context as a coroutine, optionally filtering results and selecting specific columns.

The pull_fn struct defines two overloads of the function call operator. The first overload retrieves all rows from the specified context, while the second overload allows for filtering based on a provided filter_t object. Both overloads return a coroutine that yields a map of column names to their corresponding values for each row retrieved.

Member Function Documentation

◆ operator()() [1/2]

auto oxy::context::pull_fn::operator() ( context_t const & ctx,
filter_t const & filter,
std::string const & columns = "*" ) const -> coro_t::pull_type
Parameters
ctx- The database context from which to pull rows.
filter- The filter to apply when retrieving rows.
columns- A string specifying which columns to retrieve (default is "*", meaning all columns).
Returns
A coroutine pull type that yields maps of column names to their corresponding values for each row retrieved from the context.

◆ operator()() [2/2]

auto oxy::context::pull_fn::operator() ( context_t const & ctx,
std::string const & columns = "*" ) const -> coro_t::pull_type
Parameters
ctx- The database context from which to pull rows.
columns- A string specifying which columns to retrieve (default is "*", meaning all columns).
Returns
A coroutine pull type that yields maps of column names to their corresponding values for each row retrieved from the context.