Go to file
2021-01-01 18:45:44 -08:00
cmake Initial Commit 2020-07-04 03:12:36 +03:00
src First cut at implementing float8array serializer 2021-01-01 18:45:44 -08:00
test Uncomment All Tests. 2020-12-23 03:14:23 +02:00
utility Simplify. Remove TypeMapper. 2020-10-11 17:11:39 +03:00
.gitignore Initial Commit 2020-07-04 03:12:36 +03:00
azure-pipelines.yml Ci (#1) 2020-10-13 08:34:40 +03:00
CMakeLists.txt Play around 2020-12-21 03:27:21 +02:00
docker-compose.yaml Ci (#1) 2020-10-13 08:34:40 +03:00
Dockerfile Ci (#1) 2020-10-13 08:34:40 +03:00
LICENSE Initial Commit 2020-07-04 03:12:36 +03:00
README.md Update README.md 2020-12-30 04:00:20 +02:00

oatpp-postgresql Build Status

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++:

Build And Install

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
    

API

Detailed documentation on Oat++ ORM you can find here.

Connect to Database

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"

class AppComponent {
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);
  }());

};

Supported Data Types

  • INT2
  • INT4
  • INT8
  • TIMESTAMP
  • TEXT
  • VARCHAR
  • FLOAT4
  • FLOAT8
  • BOOL
  • UUID