OZO 「お象」
Boost.Asio and libpq based asynchronous PostgreSQL unofficial header-only C++17 client library.
ozo::get_connection_type< ConnectionProvider > Struct Template Reference

#include <ozo/connection.h>

Description

template<typename ConnectionProvider>
struct ozo::get_connection_type< ConnectionProvider >

Connection type getter

This type describes the connection type from ConnectionProvider or ConnectionSource.

Template Parameters
ConnectionProvider- connection provider type to get Connection type from.

By default it assumes on ConnectionProvider::connection_type type, if no nested type connection_type is found no inner type type. The implementation example (exposition only):

template <typename T, typename = void>
struct get_connection_type_default {};
template <typename T>
struct get_connection_type_default<T,
std::void_t<typename T::connection_type> {
using type = typename T::connection_type;
};
template <typename T>
struct get_connection_type : get_connection_type_default<T>{};

Customization point

Here you can specify how to obtain Connection type from the custom ConnectionProvider. E.g. for custom Connection implementation which is used via pointer the specialization can be:

template <>
struct get_connection_type<MyConnection*> {
using type = MyConnection*;
};
ozo::connection_type
typename get_connection_type< std::decay_t< T > >::type connection_type
The connection object type that ConnectionProvider or ConnectionSource provide.
Definition: connection.h:572