userver
C++ Async Framework
Loading...
Searching...
No Matches
null.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/null.hpp
4
/// @brief NULL type
5
6
#
include
<
userver
/
storages
/
postgres
/
io
/
nullable_traits
.
hpp
>
7
#
include
<
userver
/
storages
/
postgres
/
io
/
traits
.
hpp
>
8
#
include
<
userver
/
storages
/
postgres
/
io
/
type_mapping
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
storages
::
postgres
{
13
14
/// @brief Type to represent a null value
15
template
<
typename
T>
16
struct
Null
{};
17
18
/// @brief Template variable to use with query parameters.
19
/// @code
20
/// trx->Execute("update a_table set val = $1 where val = $2", null<int>, 0)
21
/// @endcode
22
template
<
typename
T
>
23
inline
constexpr
Null
<
T
>
null
{};
24
25
namespace
io
{
26
namespace
traits
{
27
28
template
<
typename
T>
29
struct
IsNullable
<
Null
<T>> : std::true_type {};
30
31
template
<
typename
T>
32
struct
GetSetNull
<
Null
<T>> {
33
inline
static
bool
IsNull(
const
Null
<T>&) {
return
true
; }
34
static
void
SetNull(T&) {}
35
};
36
37
template
<
typename
T
>
38
struct
IsMappedToPg
<
Null
<
T
>> :
IsMappedToPg
<
T
> {};
39
template
<
typename
T
>
40
struct
IsSpecialMapping
<
Null
<
T
>> :
IsMappedToPg
<
T
> {};
41
42
}
// namespace traits
43
44
template
<
typename
T
>
45
struct
CppToPg
<
Null
<
T
>> :
CppToPg
<
T
> {};
46
47
template
<
typename
T
>
48
struct
BufferFormatter
<
Null
<
T
>> {
49
explicit
BufferFormatter
(
const
Null
<
T
>&) {}
50
51
template
<
typename
Buffer
>
52
void
operator
()(
const
UserTypes
&,
Buffer
&)
const
{}
53
};
54
55
}
// namespace io
56
57
}
// namespace storages::postgres
58
59
USERVER_NAMESPACE_END
userver
storages
postgres
null.hpp
Generated on Wed May 15 2024 22:30:01 for userver by
Doxygen
1.10.0