userver
C++ Async Framework
Loading...
Searching...
No Matches
nullable_traits.hpp
1
#
pragma
once
2
3
#
include
<
type_traits
>
4
5
#
include
<
userver
/
compiler
/
demangle
.
hpp
>
6
#
include
<
userver
/
storages
/
postgres
/
exceptions
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
storages::
postgres
::
io
::
traits
{
11
12
/// @brief Metafunction to detect nullability of a type.
13
template
<
typename
T>
14
struct
IsNullable
: std::false_type {};
15
16
template
<
typename
T>
17
concept
kIsNullable =
IsNullable
<T>::value;
// NOLINT(readability-identifier-naming)
18
19
template
<
typename
T>
20
struct
GetSetNull
{
21
inline
static
bool
IsNull(
const
T&) {
return
false
; }
22
inline
static
void
SetNull(T&) {
23
// TODO Consider a static_assert here
24
throw
TypeCannotBeNull
(
compiler
::GetTypeName<T>());
25
}
26
inline
static
void
SetDefault(T& value) { value = T{}; }
27
};
28
29
}
// namespace storages::postgres::io::traits
30
31
USERVER_NAMESPACE_END
userver
storages
postgres
io
nullable_traits.hpp
Generated on Thu May 21 2026 16:16:03 for userver by
Doxygen
1.13.2