Domains are essentially some data types with database constraints applied to them, they map to their base data types' C++ counterparts.
Other user types can be mapped to C++ types, more information on defining a mapped C++ type can be found on respective pages. After a C++ type is defined, it must be mapped to it's PostgreSQL counterpart by specialising CppToUserPg template for the type. C++ types are mapped to PostgreSQL types by their names, so the specialization for CppToUserPg template must have a static constexpr member of type DBTypeName named postgres_name.
C++ type
namespace pgtest {
struct FooBar {
pg::Integer i;
std::string s;
double d;
};
} // namespace pgtest
Declaring C++ type to PostgreSQL type mapping
Warning
The type mapping specialization must be accessible at the points where parsing/formatting of the C++ type is instantiated. The header where the C++ type is declared is an appropriate place to do it.