Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
cppgres.hpp
Go to the documentation of this file.
1
34#pragma once
35
36#ifndef cppgres_hpp
37#define cppgres_hpp
38
39#if !defined(cppgres_prefer_fmt) && __has_include(<format>)
40#include <format>
41#if (defined(__clang__) && defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT))
42#if __has_include(<fmt/core.h>)
43#define FMT_HEADER_ONLY
44#include <fmt/core.h>
45namespace cppgres::fmt {
46using ::fmt::format;
47}
48#else
49#error "Neither functional <format> nor <fmt/core.h> available"
50#endif
51#else
52namespace cppgres::fmt {
53using std::format;
54}
55#endif
56#elif __has_include(<fmt/core.h>)
57#define FMT_HEADER_ONLY
58#include <fmt/core.h>
59namespace cppgres::fmt {
60using ::fmt::format;
61}
62#else
63#error "Neither functional <format> nor <fmt/core.h> available"
64#endif
65
66#include "cppgres/bgw.hpp"
67#include "cppgres/datum.hpp"
68#include "cppgres/error.hpp"
70#include "cppgres/executor.hpp"
71#include "cppgres/function.hpp"
72#include "cppgres/guard.hpp"
73#include "cppgres/imports.h"
74#include "cppgres/memory.hpp"
75#include "cppgres/node.hpp"
76#include "cppgres/record.hpp"
77#include "cppgres/set.hpp"
78#include "cppgres/threading.hpp"
79#include "cppgres/types.hpp"
80#include "cppgres/value.hpp"
81#include "cppgres/xact.hpp"
82
97#define postgres_function(name, function) \
98 extern "C" { \
99 PG_FUNCTION_INFO_V1(name); \
100 Datum name(PG_FUNCTION_ARGS) { return cppgres::postgres_function(function)(fcinfo); } \
101 }
102
103#endif // cppgres_hpp