10#include <userver/storages/postgres/io/buffer_io.hpp> 
   11#include <userver/storages/postgres/io/buffer_io_base.hpp> 
   12#include <userver/storages/postgres/io/interval.hpp> 
   13#include <userver/storages/postgres/io/transform_io.hpp> 
   14#include <userver/storages/postgres/io/type_mapping.hpp> 
   15#include <userver/utils/strong_typedef.hpp> 
   17USERVER_NAMESPACE_BEGIN
 
   21using ClockType = std::chrono::system_clock;
 
   25using TimePoint = ClockType::time_point;
 
   32using IntervalType = std::chrono::microseconds;
 
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
  141template <
typename Rep, 
typename Period>
 
  142struct DurationIntervalCvt {
 
  143  using UserType = std::chrono::duration<Rep, Period>;
 
  144  UserType operator()(
const Interval& wire_val) 
const {
 
  145    return std::chrono::duration_cast<UserType>(wire_val.GetDuration());
 
  147  Interval operator()(
const UserType& user_val) 
const {
 
  148    return Interval{std::chrono::duration_cast<IntervalType>(user_val)};
 
  178template <
typename Duration>
 
  179struct CppToSystemPg<std::chrono::time_point<ClockType, Duration>>
 
  180    : PredefinedOid<PredefinedOids::kTimestamp> {};
 
  182template <
typename Rep, 
typename Period>
 
  183struct CppToSystemPg<std::chrono::duration<Rep, Period>>
 
  184    : PredefinedOid<PredefinedOids::kInterval> {};