#include <ozo/connection.h>
Connection provider concept
ConnectionProvider
concept represents a type that creates a connection object with an established connection to a database. The connection provider is bound to the IO execution context object. ConnectionProvider
is used by the library operations to get a connection object.
Typically it is enough to use the ConnectionSource
model with ozo::connection_provider
, but sometimes it is more convenient to model the ConnectionProvider
with type, e.g. a user has a special connection pool with deferred io_context
binding algorithm. So, in this case, this type should conform to the concept definition.
ozo::connection_provider
, Connection
model is a ConnectionProvider
by default.
Connection provider p
is an object of type P
for which these next requirements are valid:
Expression | Type | Description |
---|---|---|
ozo::get_connection(p, t, h) | Should invoke a continuation object h within time-limited by t (if not ozo::none specified) with a connection object associated with an executor object or/and error_code in case of failure. If no error_code code is set the connection object should be in a valid state. | |
ozo::connection_type<P> | deduced type | Should return a type of the Connection object that is produced by the provider. |
ozo::Connection<ozo::connection_type<P>> | std::true_type | Should provide a connection type that models the Connection concept. |
Where:
t
is the TimeConstraint
model object,h
is callable with void(ozo::error_code, ozo::connection_type<S>)
signature.