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(NYdb::TValueParser& parser,
const ParseContext& context);
20 NYdb::TValueBuilderBase<NYdb::TValueBuilder>& builder,
21 const std::optional<
typename PrimitiveTrait::Type>& value
25 NYdb::TValueBuilderBase<NYdb::TParamValueBuilder>& builder,
26 const std::optional<
typename PrimitiveTrait::Type>& value
29 static NYdb::TType MakeType();
32template <
typename PrimitiveTrait>
34 static typename PrimitiveTrait::Type Parse(NYdb::TValueParser& parser,
const ParseContext& context);
37 Write(NYdb::TValueBuilderBase<NYdb::TValueBuilder>& builder,
const typename PrimitiveTrait::Type& value);
40 Write(NYdb::TValueBuilderBase<NYdb::TParamValueBuilder>& builder,
const typename PrimitiveTrait::Type& value);
42 static NYdb::TType MakeType();
47 static Type Parse(
const NYdb::TValueParser& value_parser);
48 template <
typename Builder>
49 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
53 using Type = std::int32_t;
54 static Type Parse(
const NYdb::TValueParser& value_parser);
55 template <
typename Builder>
56 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
60 using Type = std::uint32_t;
61 static Type Parse(
const NYdb::TValueParser& value_parser);
62 template <
typename Builder>
63 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
67 using Type = std::int64_t;
68 static Type Parse(
const NYdb::TValueParser& value_parser);
69 template <
typename Builder>
70 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
74 using Type = std::uint64_t;
75 static Type Parse(
const NYdb::TValueParser& value_parser);
76 template <
typename Builder>
77 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
82 static Type Parse(
const NYdb::TValueParser& value_parser);
83 template <
typename Builder>
84 static void Write(NYdb::TValueBuilderBase<Builder>& builder, Type value);
88 using Type = std::string;
89 static Type Parse(
const NYdb::TValueParser& value_parser);
90 template <
typename Builder>
91 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
const Type& value);
96 static Type Parse(
const NYdb::TValueParser& value_parser);
97 template <
typename Builder>
98 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
const Type& value);
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,
const Type& value);
117 static Type Parse(
const NYdb::TValueParser& value_parser);
118 template <
typename Builder>
119 static void Write(NYdb::TValueBuilderBase<Builder>& builder,
const Type& value);
123struct ValueTraits<std::optional<JsonDocumentTrait::Type>> : OptionalPrimitiveTraits<JsonDocumentTrait> {};
126struct ValueTraits<JsonDocument> : PrimitiveTraits<JsonDocumentTrait> {};
129struct ValueTraits<std::optional<JsonTrait::Type>> : OptionalPrimitiveTraits<JsonTrait> {};
132struct ValueTraits<formats::json::Value> : PrimitiveTraits<JsonTrait> {};
135struct ValueTraits<std::optional<TimestampTrait::Type>> : OptionalPrimitiveTraits<TimestampTrait> {};
138struct ValueTraits<TimestampTrait::Type> : PrimitiveTraits<TimestampTrait> {};
141struct ValueTraits<std::optional<Utf8Trait::Type>> : OptionalPrimitiveTraits<Utf8Trait> {};
144struct ValueTraits<Utf8Trait::Type> : PrimitiveTraits<Utf8Trait> {};
147struct ValueTraits<std::optional<StringTrait::Type>> : OptionalPrimitiveTraits<StringTrait> {};
150struct ValueTraits<StringTrait::Type> : PrimitiveTraits<StringTrait> {};
153struct ValueTraits<std::optional<DoubleTrait::Type>> : OptionalPrimitiveTraits<DoubleTrait> {};
156struct ValueTraits<DoubleTrait::Type> : PrimitiveTraits<DoubleTrait> {};
159struct ValueTraits<std::optional<Uint64Trait::Type>> : OptionalPrimitiveTraits<Uint64Trait> {};
162struct ValueTraits<Uint64Trait::Type> : PrimitiveTraits<Uint64Trait> {};
165struct ValueTraits<std::optional<Int64Trait::Type>> : OptionalPrimitiveTraits<Int64Trait> {};
168struct ValueTraits<Int64Trait::Type> : PrimitiveTraits<Int64Trait> {};
171struct ValueTraits<std::optional<Uint32Trait::Type>> : OptionalPrimitiveTraits<Uint32Trait> {};
174struct ValueTraits<Uint32Trait::Type> : PrimitiveTraits<Uint32Trait> {};
177struct ValueTraits<std::optional<Int32Trait::Type>> : OptionalPrimitiveTraits<Int32Trait> {};
180struct ValueTraits<Int32Trait::Type> : PrimitiveTraits<Int32Trait> {};
183struct ValueTraits<std::optional<BoolTrait::Type>> : OptionalPrimitiveTraits<BoolTrait> {};
186struct ValueTraits<BoolTrait::Type> : PrimitiveTraits<BoolTrait> {};