11#include <userver/storages/postgres/exceptions.hpp>
12#include <userver/storages/postgres/io/buffer_io.hpp>
13#include <userver/storages/postgres/io/buffer_io_base.hpp>
14#include <userver/storages/postgres/io/type_mapping.hpp>
16USERVER_NAMESPACE_BEGIN
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
55template <
typename... VectorArgs>
57template <
typename... VectorArgs>
62inline constexpr bool kIsByteaCompatible = IsByteaCompatible<T>::value;
71template <
typename ByteContainerRef>
72struct ByteaRefWrapper {
73 static_assert(std::is_reference<ByteContainerRef>::value,
74 "The container must be passed by reference");
76 using BytesType = std::decay_t<ByteContainerRef>;
78 io::traits::kIsByteaCompatible<BytesType>,
79 "This C++ type cannot be used with PostgreSQL `bytea` data type");
81 ByteContainerRef bytes;
87template <
typename ByteContainer>
88detail::ByteaRefWrapper<
const ByteContainer&>
Bytea(
89 const ByteContainer& bytes) {
94template <
typename ByteContainer>
95detail::ByteaRefWrapper<ByteContainer&>
Bytea(ByteContainer& bytes) {
100template <
typename ByteContainer>
106 "This C++ type cannot be used with PostgreSQL `bytea` data type");
161 template <
typename Buffer>
177 template <
typename Buffer>
183template <
typename ByteContainer>
184struct CppToSystemPg<
postgres::detail::ByteaRefWrapper<ByteContainer>>
185 : PredefinedOid<PredefinedOids::kBytea> {};
186template <
typename ByteContainer>
188 : PredefinedOid<PredefinedOids::kBytea> {};