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>
35inline constexpr bool kIsByteaCompatible = IsByteaCompatible<T>::value;
44template <
typename ByteContainerRef>
45struct ByteaRefWrapper {
46 static_assert(std::is_reference<ByteContainerRef>::value,
"The container must be passed by reference");
48 using BytesType = std::decay_t<ByteContainerRef>;
50 io::traits::kIsByteaCompatible<BytesType>,
51 "This C++ type cannot be used with PostgreSQL `bytea` data type"
54 ByteContainerRef bytes;
68template <
typename ByteContainer>
69detail::ByteaRefWrapper<
const ByteContainer&>
Bytea(
const ByteContainer& bytes) {
82template <
typename ByteContainer>
83detail::ByteaRefWrapper<ByteContainer&>
Bytea(ByteContainer& bytes) {
88template <
typename ByteContainer>
92 constexpr static bool kIsPostgresBuildInTypeWrapper =
true;
96 "This C++ type cannot be used with PostgreSQL `bytea` data type"
140 template <
typename Buffer>
155 template <
typename Buffer>
161template <
typename ByteContainer>
162struct CppToSystemPg<
postgres::detail::ByteaRefWrapper<ByteContainer>> : PredefinedOid<PredefinedOids::kBytea> {};
163template <
typename ByteContainer>