6#include <userver/formats/json_fwd.hpp>
8#include <userver/ydb/io/traits.hpp>
9#include <userver/ydb/types.hpp>
11USERVER_NAMESPACE_BEGIN
15template <
typename PrimitiveTrait>
17 static std::optional<
typename PrimitiveTrait::Type> Parse(
18 NYdb::TValueParser& parser,
const ParseContext& context);
20 static void Write(NYdb::TValueBuilderBase<NYdb::TValueBuilder>& builder,
21 const std::optional<
typename PrimitiveTrait::Type>& value);
23 static void Write(NYdb::TValueBuilderBase<NYdb::TParamValueBuilder>& builder,
24 const std::optional<
typename PrimitiveTrait::Type>& value);
26 static NYdb::TType MakeType();
29template <
typename PrimitiveTrait>
31 static typename PrimitiveTrait::Type Parse(NYdb::TValueParser& parser,
32 const ParseContext& context);
34 static void Write(NYdb::TValueBuilderBase<NYdb::TValueBuilder>& builder,
35 const typename PrimitiveTrait::Type& value);
37 static void Write(NYdb::TValueBuilderBase<NYdb::TParamValueBuilder>& builder,
38 const typename PrimitiveTrait::Type& value);
40 static NYdb::TType MakeType();
45 static Type Parse(
const NYdb::TValueParser& value_parser);
46 template <
typename Builder>
47 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
51 using Type = std::int32_t;
52 static Type Parse(
const NYdb::TValueParser& value_parser);
53 template <
typename Builder>
54 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
58 using Type = std::uint32_t;
59 static Type Parse(
const NYdb::TValueParser& value_parser);
60 template <
typename Builder>
61 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
65 using Type = std::int64_t;
66 static Type Parse(
const NYdb::TValueParser& value_parser);
67 template <
typename Builder>
68 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
72 using Type = std::uint64_t;
73 static Type Parse(
const NYdb::TValueParser& value_parser);
74 template <
typename Builder>
75 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
80 static Type Parse(
const NYdb::TValueParser& value_parser);
81 template <
typename Builder>
82 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
86 using Type = std::string;
87 static Type Parse(
const NYdb::TValueParser& value_parser);
88 template <
typename Builder>
89 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
95 static Type Parse(
const NYdb::TValueParser& value_parser);
96 template <
typename Builder>
97 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
102 using Type = Timestamp;
103 static Type Parse(
const NYdb::TValueParser& value_parser);
104 template <
typename Builder>
105 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
109 using Type = formats::
json::Value;
110 static Type Parse(
const NYdb::TValueParser& value_parser);
111 template <
typename Builder>
112 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
118 static Type Parse(
const NYdb::TValueParser& value_parser);
119 template <
typename Builder>
120 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
125struct ValueTraits<std::optional<JsonDocumentTrait::Type>>
126 : OptionalPrimitiveTraits<JsonDocumentTrait> {};
129struct ValueTraits<JsonDocument> : PrimitiveTraits<JsonDocumentTrait> {};
132struct ValueTraits<std::optional<JsonTrait::Type>>
133 : OptionalPrimitiveTraits<JsonTrait> {};
136struct ValueTraits<formats::json::Value> : PrimitiveTraits<JsonTrait> {};
139struct ValueTraits<std::optional<TimestampTrait::Type>>
140 : OptionalPrimitiveTraits<TimestampTrait> {};
143struct ValueTraits<TimestampTrait::Type> : PrimitiveTraits<TimestampTrait> {};
146struct ValueTraits<std::optional<Utf8Trait::Type>>
147 : OptionalPrimitiveTraits<Utf8Trait> {};
150struct ValueTraits<Utf8Trait::Type> : PrimitiveTraits<Utf8Trait> {};
153struct ValueTraits<std::optional<StringTrait::Type>>
154 : OptionalPrimitiveTraits<StringTrait> {};
157struct ValueTraits<StringTrait::Type> : PrimitiveTraits<StringTrait> {};
160struct ValueTraits<std::optional<DoubleTrait::Type>>
161 : OptionalPrimitiveTraits<DoubleTrait> {};
164struct ValueTraits<DoubleTrait::Type> : PrimitiveTraits<DoubleTrait> {};
167struct ValueTraits<std::optional<Uint64Trait::Type>>
168 : OptionalPrimitiveTraits<Uint64Trait> {};
171struct ValueTraits<Uint64Trait::Type> : PrimitiveTraits<Uint64Trait> {};
174struct ValueTraits<std::optional<Int64Trait::Type>>
175 : OptionalPrimitiveTraits<Int64Trait> {};
178struct ValueTraits<Int64Trait::Type> : PrimitiveTraits<Int64Trait> {};
181struct ValueTraits<std::optional<Uint32Trait::Type>>
182 : OptionalPrimitiveTraits<Uint32Trait> {};
185struct ValueTraits<Uint32Trait::Type> : PrimitiveTraits<Uint32Trait> {};
188struct ValueTraits<std::optional<Int32Trait::Type>>
189 : OptionalPrimitiveTraits<Int32Trait> {};
192struct ValueTraits<Int32Trait::Type> : PrimitiveTraits<Int32Trait> {};
195struct ValueTraits<std::optional<BoolTrait::Type>>
196 : OptionalPrimitiveTraits<BoolTrait> {};
199struct ValueTraits<BoolTrait::Type> : PrimitiveTraits<BoolTrait> {};