1#include <userver/proto-structs/io/userver/proto_structs/date.hpp>
3#include <google/type/date.pb.h>
5#include <userver/proto-structs/exceptions.hpp>
6#include <userver/proto-structs/io/context.hpp>
7#include <userver/utils/impl/internal_tag.hpp>
9namespace proto_structs::io {
11Date ReadProtoStruct(ReadContext& ctx, To<Date>,
const ::google::type::Date& msg)
try
13 return Date(utils::
impl::InternalTag{}, msg.year(), msg.month(), msg.day());
14}
catch (
const ValueError& e) {
15 ctx.AddError(e.what());
19void WriteProtoStruct(WriteContext&,
const Date& obj, ::google::type::Date& msg) {
20 msg.set_year(obj.YearNum());
21 msg.set_month(obj.MonthNum());
22 msg.set_day(obj.DayNum());