userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
numeric_data.hpp
1
#
pragma
once
2
3
#
include
<
userver
/
storages
/
postgres
/
io
/
buffer_io
.
hpp
>
4
5
#
include
<
userver
/
utils
/
zstring_view
.
hpp
>
6
7
USERVER_NAMESPACE_BEGIN
8
9
namespace
storages::
postgres
::
io
::detail {
10
11
/// All digits packed in a single integer value, if the size of int64 is enough
12
struct
IntegralRepresentation {
13
std::int64_t value;
14
int
fractional_digit_count;
15
};
16
17
/// A helper function to read PostgreSQL binary buffer containing a
18
/// numeric/decimal to string representation
19
std::string NumericBufferToString(
const
FieldBuffer
& buffer);
20
/// A helper function to write string representation of a numeric/decimal to
21
/// PostgreSQL binary buffer representation
22
std::string StringToNumericBuffer(USERVER_NAMESPACE::
utils
::
zstring_view
str_rep);
23
24
/// A helper function to read PostgreSQL numeric/decimal binary buffer and pack
25
/// the value in a single int64 value.
26
/// @throw NumericOverflow if the int64 is not enough to represent value in the
27
/// buffer
28
/// @throw ValueIsNaN if the value in the buffer is NaN
29
IntegralRepresentation NumericBufferToInt64(
const
FieldBuffer
& buffer);
30
/// A helper function to write PostgreSQL numeric/decimal binary buffer using
31
/// a value packed into a single int64 value.
32
/// @throw InvalidRepresentation if the dec_digits field of binary
33
/// representation is unreasonable
34
std::string Int64ToNumericBuffer(
const
IntegralRepresentation& rep);
35
36
}
// namespace storages::postgres::io::detail
37
38
USERVER_NAMESPACE_END
userver
storages
postgres
io
numeric_data.hpp
Generated on
for userver by
Doxygen
1.17.0