Oat++ ORM adapter for PostgreSQL.
Note: this alpha version, which means that not all PostgreSQL data-types are supported. See the list of Supported Data Types.
More about Oat++:
Note: you need to install the main oatpp module and PostgreSQL dev package first.
- Clone this repository.
- In the root of the repository run:
mkdir build &&cd build cmake .. make install
Detailed documentation on Oat++ ORM you can find here.
All you need to start using oatpp ORM with PostgreSQL is to create oatpp::postgresql::Executor and provide it to your DbClient.
#include"db/MyClient.hpp"
#include"oatpp-postgresql/orm.hpp"classAppComponent {
public:/** * Create DbClient component.*/OATPP_CREATE_COMPONENT(std::shared_ptr<db::MyClient>, myDatabaseClient)([] {
/* Create database-specific ConnectionProvider */auto connectionProvider = std::make_shared<oatpp::postgresql::ConnectionProvider>("<connection-string>"); /* Create database-specific ConnectionPool */auto connectionPool = oatpp::postgresql::ConnectionPool::createShared(connectionProvider, 10/* max-connections */, std::chrono::seconds(5) /* connection TTL */);
/* Create database-specific Executor */auto executor = std::make_shared<oatpp::postgresql::Executor>(connectionPool);
/* Create MyClient database client */return std::make_shared<MyClient>(executor);
}());
};| Type | Supported | In Array |
|---|---|---|
| INT2 | + | + |
| INT4 | + | + |
| INT8 | + | + |
| TIMESTAMP | + | + |
| TEXT | + | + |
| VARCHAR | + | + |
| FLOAT4 | + | + |
| FLOAT8 | + | + |
| BOOL | + | + |
| UUID | + | + |
| Other Types | - | - |