How do I define a custom citext type provided by postgres as an extension in code? The example provided in this video does not work. This code does not compile
https://www.youtube.com/watch?v=-1zbaxuUsMA
namespace test {
OZO_STRONG_TYPEDEF(std::string, citext)
}
OZO_PG_DEFINE_CUSTOM_TYPE(test::citext, "citext", dynamic_size)
namespace asio = boost::asio;
using namespace ozo::literals;
using namespace std::chrono_literals;
int main() {
using namespace std::chrono_literals;
const auto oid_map = ozo::register_types<test::citext>();
boost::asio::io_context io;
std::string dbOpts = "host=localhost port=5432 dbname=postgres user=postgres password=postgres";
const ozo::connection_info<decltype(oid_map)> connection_info( dbOpts);
ozo::connection_pool_config connection_pool_config;
connection_pool_config.capacity = 4;
connection_pool_config.queue_capacity = 10;
connection_pool_config.idle_timeout = std::chrono::seconds(60);
connection_pool_config.lifespan = std::chrono::hours(24);
ozo::connection_pool connection_pool(connection_info, connection_pool_config);
std::vector<test::citext> rows;
ozo::request(connection_pool[io], "SELECT 'TeSt'::CITEXT"_SQL, 1s, ozo::into(rows), [&](auto ec, auto conn){
if (ec) {
std::cerr << ec.message();
std::cerr << " | " << ozo::error_message(conn);
if (!ozo::is_null_recursive(conn)) {
std::cerr << " | " << ozo::get_error_context(conn);
}
}
});
for (auto row : rows){
std::cout << row.get() << std::endl;
}
io.run();
}
How do I define a custom citext type provided by postgres as an extension in code? The example provided in this video does not work. This code does not compile
https://www.youtube.com/watch?v=-1zbaxuUsMA