3#include <userver/storages/postgres/io/type_mapping.hpp>
4#include <userver/utils/void_t.hpp>
8namespace storages::
postgres::io::detail {
10template <
typename T,
typename = USERVER_NAMESPACE::utils::void_t<>>
11struct ShouldInitMapping : std::false_type {};
14struct ShouldInitMapping<T, USERVER_NAMESPACE::utils::void_t<
decltype(T::init_)>> : std::true_type {};
17struct BufferParserBase {
21 explicit BufferParserBase(ValueType& v) : value{v} {
22 using PgMapping = CppToPg<ValueType>;
23 if constexpr (ShouldInitMapping<PgMapping>{}) {
24 ForceReference(PgMapping::init_);
30struct BufferParserBase<T&&> {
34 explicit BufferParserBase(ValueType&& v) : value{std::move(v)} {
35 using PgMapping = CppToPg<ValueType>;
36 if constexpr (ShouldInitMapping<PgMapping>{}) {
37 ForceReference(PgMapping::init_);
43struct BufferFormatterBase {
45 const ValueType& value;
46 explicit BufferFormatterBase(
const ValueType& v) : value{v} {}