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
29template <
typename... VectorArgs>
31template <
typename... VectorArgs>
36inline constexpr bool kIsByteaCompatible = IsByteaCompatible<T>::value;
45template <
typename ByteContainerRef>
46struct ByteaRefWrapper {
47 static_assert(std::is_reference<ByteContainerRef>::value,
48 "The container must be passed by reference");
50 using BytesType = std::decay_t<ByteContainerRef>;
52 io::traits::kIsByteaCompatible<BytesType>,
53 "This C++ type cannot be used with PostgreSQL `bytea` data type");
55 ByteContainerRef bytes;
61template <
typename ByteContainer>
62detail::ByteaRefWrapper<
const ByteContainer&>
Bytea(
63 const ByteContainer& bytes) {
68template <
typename ByteContainer>
69detail::ByteaRefWrapper<ByteContainer&>
Bytea(ByteContainer& bytes) {
74template <
typename ByteContainer>
80 "This C++ type cannot be used with PostgreSQL `bytea` data type");
135 template <
typename Buffer>
151 template <
typename Buffer>
157template <
typename ByteContainer>
158struct CppToSystemPg<
postgres::detail::ByteaRefWrapper<ByteContainer>>
159 : PredefinedOid<PredefinedOids::kBytea> {};
160template <
typename ByteContainer>
162 : PredefinedOid<PredefinedOids::kBytea> {};