⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
decimal64.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/io/decimal64.hpp
4
/// @brief decimal64::Decimal I/O support
5
/// @ingroup userver_postgres_parse_and_format
6
7
#
include
<
userver
/
decimal64
/
decimal64
.
hpp
>
8
#
include
<
userver
/
storages
/
postgres
/
io
/
buffer_io
.
hpp
>
9
#
include
<
userver
/
storages
/
postgres
/
io
/
buffer_io_base
.
hpp
>
10
#
include
<
userver
/
storages
/
postgres
/
io
/
numeric_data
.
hpp
>
11
#
include
<
userver
/
storages
/
postgres
/
io
/
type_mapping
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
storages
::
postgres
::
io
{
16
17
template
<
int
Prec
,
typename
RoundPolicy
>
18
struct
BufferFormatter
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>>
19
:
detail
::
BufferFormatterBase
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>> {
20
using
BaseType
=
21
detail
::
BufferFormatterBase
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>>;
22
using
BaseType
::
BaseType
;
23
using
ValueType
=
typename
BaseType
::
ValueType
;
24
25
template
<
typename
Buffer
>
26
void
operator
()(
const
UserTypes
&,
Buffer
&
buffer
)
const
{
27
auto
bin_str
=
28
detail
::
Int64ToNumericBuffer
({
this
->
value
.
AsUnbiased
(),
Prec
});
29
buffer
.
reserve
(
buffer
.
size
() +
bin_str
.
size
());
30
std
::
copy
(
bin_str
.
begin
(),
bin_str
.
end
(),
std
::
back_inserter
(
buffer
));
31
}
32
};
33
34
template
<
int
Prec
,
typename
RoundPolicy
>
35
struct
BufferParser
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>>
36
:
detail
::
BufferParserBase
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>> {
37
using
BaseType
=
38
detail
::
BufferParserBase
<
decimal64
::
Decimal
<
Prec
,
RoundPolicy
>>;
39
using
BaseType
::
BaseType
;
40
using
ValueType
=
typename
BaseType
::
ValueType
;
41
42
void
operator
()(
const
FieldBuffer
&
buffer
) {
43
auto
rep
=
detail
::
NumericBufferToInt64
(
buffer
);
44
this
->
value
=
ValueType
::
FromBiased
(
rep
.
value
,
rep
.
fractional_digit_count
);
45
}
46
};
47
48
template
<
int
Prec,
typename
RoundPolicy>
49
struct
CppToSystemPg<
decimal64
::
Decimal
<Prec, RoundPolicy>>
50
: PredefinedOid<PredefinedOids::kNumeric> {};
51
}
// namespace storages::postgres::io
52
53
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
storages
postgres
io
decimal64.hpp
Generated on Wed May 15 2024 22:32:03 for userver by
Doxygen
1.10.0