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;
69template <
typename ByteContainer>
70detail::ByteaRefWrapper<
const ByteContainer&>
Bytea(
71 const ByteContainer& bytes) {
84template <
typename ByteContainer>
85detail::ByteaRefWrapper<ByteContainer&>
Bytea(ByteContainer& bytes) {
90template <
typename ByteContainer>
96 "This C++ type cannot be used with PostgreSQL `bytea` data type");
151 template <
typename Buffer>
167 template <
typename Buffer>
173template <
typename ByteContainer>
174struct CppToSystemPg<
postgres::detail::ByteaRefWrapper<ByteContainer>>
175 : PredefinedOid<PredefinedOids::kBytea> {};
176template <
typename ByteContainer>
178 : PredefinedOid<PredefinedOids::kBytea> {};