blob: 295d3c002a54d04cbf9a675e61b102e0ed2656f1 (
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
|
#include "impl.h"
#include <ydb/public/api/protos/ydb_scheme.pb.h>
#include <ydb/public/api/protos/ydb_value.pb.h>
#include <util/generic/map.h>
namespace NYdb {
TParams::TImpl::TImpl(::google::protobuf::Map<TString, Ydb::TypedValue>&& paramsMap) {
ParamsMap_.swap(paramsMap);
}
bool TParams::TImpl::Empty() const {
return ParamsMap_.empty();
}
TMap<TString, TValue> TParams::TImpl::GetValues() const {
TMap<TString, TValue> valuesMap;
for (auto it = ParamsMap_.begin(); it != ParamsMap_.end(); ++it) {
auto paramType = TType(it->second.type());
auto paramValue = TValue(paramType, it->second.value());
valuesMap.emplace(it->first, paramValue);
}
return valuesMap;
}
TMaybe<TValue> TParams::TImpl::GetValue(const TString& name) const {
auto it = ParamsMap_.find(name);
if (it != ParamsMap_.end()) {
auto paramType = TType(it->second.type());
return TValue(paramType, it->second.value());
}
return TMaybe<TValue>();
}
::google::protobuf::Map<TString, Ydb::TypedValue>* TParams::TImpl::GetProtoMapPtr() {
return &ParamsMap_;
}
const ::google::protobuf::Map<TString, Ydb::TypedValue>& TParams::TImpl::GetProtoMap() const {
return ParamsMap_;
}
} // namespace NYdb
|