summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/proto_parser/reflection.cpp
blob: 424191c52156ce217736841c9487291b6a353f18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "reflection.h"

namespace NSQLTranslationV1 {

TString GetDescription(
    const google::protobuf::Message& node,
    const google::protobuf::FieldDescriptor* d)
{
    const auto& field = node.GetReflection()->GetMessage(node, d);
    return field.GetReflection()->GetString(field, d->message_type()->FindFieldByName("Descr"));
}

TString AltDescription(
    const google::protobuf::Message& node,
    ui32 altCase,
    const google::protobuf::Descriptor* descr)
{
    return GetDescription(node, descr->FindFieldByNumber(altCase));
}

} // namespace NSQLTranslationV1