OZO is a C++17 Boost.Asio based header-only library for asyncronous communication with PostgreSQL DBMS.
POSTGRESQL License
OZO is a C++17 library for asyncronous communication with PostgreSQL DBMS. The library leverages the power of template metaprogramming, providing convenient mapping from C++ types to SQL along with rich query building possibilities. OZO supports different concurrency paradigms (callbacks, futures, coroutines), using Boost.Asio under the hood. Low-level communication with PostgreSQL server is done via libpq. All concepts in the library are designed to be easily extendable (even replaceable) by the user to simplify adaptation to specific project requirements.
Since the project is on early state of development it lacks of documentation. We understand the importance of good docs and are working hard on this problem. Complete documentation is on the way, but now:
For the time OZO is not compatible with new executors models that are used by default since Boost 1.74. The BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
macro needs to be defined. See Boost 1.74 changelog for the details.
These things are needed:
BOOST_HANA_CONFIG_ENABLE_STRING_UDL
defined.If you want to run integration tests and/or build inside Docker container:
The library is header-only, but if you want to build and run unit-tests you can do it as listed below.
First of all you need to satsfy requirements listed above. You can run tests using these commands.
mkdir -p build
cd build
cmake .. -DOZO_BUILD_TESTS=ON
make -j$(nproc)
ctest -V
Or use build.sh which accepts folowing commands:
scripts/build.sh help
prints help.
scripts/build.sh <compiler> <target>
build and run tests with specified compiler and target, the compiler parameter can be:
The target parameter depends on compiler. For gcc:
For clang:
scripts/build.sh all
build all possible configuration.
scripts/build.sh docs
generates documentation.
For MacOS the best way to satisfy minimum requirements is brew
brew install cmake boost libpq postresql
To build code and run tests inside docker container:
scripts/build.sh docker <compiler> <target>
To generate documentation using docker container:
scripts/build.sh docker docs
You can use scripts/build.sh
but add pg
first:
scripts/build.sh pg <compiler> <target>
or if you want build code in docker:
scripts/build.sh pg docker <compiler> <target>
This will attempt to launch postgres:alpine from your Docker registry. Or you can point ozo tests to a postgres of your choosing by setting these environment variables prior to building:
export OZO_BUILD_PG_TESTS=ON
export OZO_PG_TEST_CONNINFO='your conninfo (connection string)'
scripts/build.sh gcc debug