10#include <userver/storages/postgres/detail/db_data_type_name.hpp>
12USERVER_NAMESPACE_BEGIN
18using Oid =
unsigned int;
19inline constexpr Oid kInvalidOid = 0;
23using Smallint = std::int16_t;
24using Integer = std::int32_t;
25using Bigint = std::int64_t;
35 const std::string_view schema;
36 const std::string_view name;
38 constexpr DBTypeName() : schema{}, name{} {}
39 explicit constexpr DBTypeName(std::pair<std::string_view, std::string_view> n) : schema(n.first), name(n.second) {}
45 constexpr DBTypeName(std::string_view s, std::string_view n) : schema(s), name(n) {}
47 bool operator==(
const DBTypeName& rhs)
const {
return name == rhs.name && schema == rhs.schema; }
49 auto schema_cmp = schema.compare(rhs.schema);
52 }
else if (schema_cmp == 0) {
53 return name < rhs.name;
58 bool Empty()
const {
return name.empty(); }
59 std::size_t GetHash()
const;
60 std::string ToString()
const;
68 enum class TypeClass :
char {
129 std::size_t GetNameHash()
const;
132 std::size_t operator()(
const DBTypeDescription& type)
const {
return type.GetNameHash(); }
141 auto operator()(
TypeCategory val)
const {
return std::hash<IntegralType>{}(
static_cast<IntegralType>(val)); }
147 Oid owner{kInvalidOid};
149 Oid type{kInvalidOid};
172 kInvalid = kInvalidOid,
210 kMacaddrArray = 1040,
212 kMacaddr8Array = 775,
217 kBooleanArray = 1000,
228 kVarcharArray = 1015,
236 kPolygonArray = 1027,
239 kCstringArray = 1263,
247 kTimestampArray = 1115,
249 kTimestamptzArray = 1185,
251 kIntervalArray = 1187,
252 kNumericArray = 1231,
260 kRegprocedure = 2202,
266 kRegtypearray = 2211,
275 kRegdictionary = 3769,
286 kLanguageHandler = 2280,
295 kInt4RangeArray = 3905,
297 kNumRangeArray = 3907,
298 kTimestampRange = 3908,
299 kTimestampRangeArray = 3909,
300 kTimestamptzRange = 3910,
301 kTimestamptzRangeArray = 3911,
303 kDateRangeArray = 3913,
305 kInt8RangeArray = 3927,
308template <PredefinedOids TypeOid>
309using PredefinedOid = std::integral_constant<PredefinedOids, TypeOid>;
442 return static_cast<std::size_t>(value);
448 std::size_t operator()(
const USERVER_NAMESPACE::storages::
postgres::
DBTypeName& value)
const {
449 return value.GetHash();