blob: 8325bd5809bff4f0e0c0f779a97a0914bcd67a26 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "type_builder.h"
#include "proto_builder.h"
#include <yql/essentials/public/udf/udf_value.h>
#include <google/protobuf/message.h>
namespace NYql {
namespace NUdf {
class TProtobufValue: public TBoxedValue {
public:
TProtobufValue(const TProtoInfo& info);
~TProtobufValue() override;
TUnboxedValue Run(
const IValueBuilder* valueBuilder,
const TUnboxedValuePod* args) const override;
virtual TAutoPtr<NProtoBuf::Message> Parse(const TStringBuf& data) const = 0;
protected:
const TProtoInfo Info_;
};
class TProtobufSerialize: public TBoxedValue {
public:
TProtobufSerialize(const TProtoInfo& info);
~TProtobufSerialize() override;
TUnboxedValue Run(
const IValueBuilder* valueBuilder,
const TUnboxedValuePod* args) const override;
virtual TMaybe<TString> Serialize(const NProtoBuf::Message& proto) const = 0;
virtual TAutoPtr<NProtoBuf::Message> MakeProto() const = 0;
protected:
const TProtoInfo Info_;
};
TUnboxedValue FillValueFromProto(
const NProtoBuf::Message& proto,
const IValueBuilder* valueBuilder,
const TProtoInfo& info);
} // namespace NUdf
} // namespace NYql
|