OZO 「お象」
Boost.Asio and libpq based asynchronous PostgreSQL unofficial header-only C++17 client library.
Handler Interface Reference

#include <ozo/core/concept.h>

Description

Handler concept.

Handler is a function or a functor which is used as a callback for handling result of asynchronous IO operations in the library.

In case of function it has to have this signature:

template <typename Connection>
void Handler(ozo::error_code ec, Connection&& connection) {
//...
}

In case of functor it has to have such operator():

struct Handler {
template <typename Connection>
void operator() (ozo::error_code ec, Connection&& connection) {
//...
}
};

In case of lambda:

auto Handler = [&] (ozo::error_code ec, auto connection) {
//...
};

Handler has to handle an ozo::error_code object as first argument, and the Connection implementation object as a second one. It is better to define second argument as a template parameter because the implementation depends on a numerous of compile-time options but if it is really needed - real type can be obtained with ozo::connection_type.

Handler has to be invoked according to ec state:

ozo::error_code
boost::system::error_code error_code
Error code representation of the library.
Definition: error.h:38
Handler
Handler concept.
Connection
Database connection concept.