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)
40 : schema(n.first), name(n.second) {}
47 constexpr DBTypeName(std::string_view s, std::string_view n)
48 : schema(s), name(n) {}
51 return name == rhs.name && schema == rhs.schema;
54 auto schema_cmp = schema.compare(rhs.schema);
57 }
else if (schema_cmp == 0) {
58 return name < rhs.name;
63 bool Empty()
const {
return name.empty(); }
64 std::size_t GetHash()
const;
65 std::string ToString()
const;
73 enum class TypeClass :
char {
142 DBTypeName GetName()
const {
return {schema.c_str(), name.c_str()}; }
143 std::size_t GetNameHash()
const;
147 return type.GetNameHash();
153 return lhs.name == rhs.name && lhs.schema == rhs.schema;
159 return std::hash<IntegralType>{}(
static_cast<IntegralType>(val));
166 Oid owner{kInvalidOid};
168 Oid type{kInvalidOid};
191 kInvalid = kInvalidOid,
229 kMacaddrArray = 1040,
231 kMacaddr8Array = 775,
236 kBooleanArray = 1000,
247 kVarcharArray = 1015,
255 kPolygonArray = 1027,
258 kCstringArray = 1263,
266 kTimestampArray = 1115,
268 kTimestamptzArray = 1185,
270 kIntervalArray = 1187,
271 kNumericArray = 1231,
279 kRegprocedure = 2202,
285 kRegtypearray = 2211,
294 kRegdictionary = 3769,
305 kLanguageHandler = 2280,
314 kInt4RangeArray = 3905,
316 kNumRangeArray = 3907,
317 kTimestampRange = 3908,
318 kTimestampRangeArray = 3909,
319 kTimestamptzRange = 3910,
320 kTimestamptzRangeArray = 3911,
322 kDateRangeArray = 3913,
324 kInt8RangeArray = 3927,
506 std::size_t operator()(
508 return static_cast<std::size_t>(value);
514 std::size_t operator()(
516 return value.GetHash();