3#include <userver/storages/postgres/io/type_mapping.hpp>
4#include <userver/utils/void_t.hpp>
10template <
typename T,
typename = USERVER_NAMESPACE::utils::void_t<>>
11struct ShouldInitMapping : std::false_type {};
14struct ShouldInitMapping<T,
15 USERVER_NAMESPACE::utils::void_t<
decltype(T::init_)>>
19struct BufferParserBase {
23 explicit BufferParserBase(ValueType& v) : value{v} {
24 using PgMapping = CppToPg<ValueType>;
25 if constexpr (ShouldInitMapping<PgMapping>{}) {
26 ForceReference(PgMapping::init_);
32struct BufferParserBase<T&&> {
36 explicit BufferParserBase(ValueType&& v) : value{std::move(v)} {
37 using PgMapping = CppToPg<ValueType>;
38 if constexpr (ShouldInitMapping<PgMapping>{}) {
39 ForceReference(PgMapping::init_);
45struct BufferFormatterBase {
47 const ValueType& value;
48 explicit BufferFormatterBase(
const ValueType& v) : value{v} {}