MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / KeyAsString

Function KeyAsString

eval/public/value_export_util.cc:18–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16using google::protobuf::util::TimeUtil;
17
18absl::Status KeyAsString(const CelValue& value, std::string* key) {
19 switch (value.type()) {
20 case CelValue::Type::kInt64: {
21 *key = absl::StrCat(value.Int64OrDie());
22 break;
23 }
24 case CelValue::Type::kUint64: {
25 *key = absl::StrCat(value.Uint64OrDie());
26 break;
27 }
28 case CelValue::Type::kString: {
29 key->assign(value.StringOrDie().value().data(),
30 value.StringOrDie().value().size());
31 break;
32 }
33 default: {
34 return absl::InvalidArgumentError("Unsupported map type");
35 }
36 }
37 return absl::OkStatus();
38}
39
40// Export content of CelValue as google.protobuf.Value.
41absl::Status ExportAsProtoValue(const CelValue& in_value, Value* out_value,

Callers 1

ExportAsProtoValueFunction · 0.85

Calls 6

typeMethod · 0.80
Int64OrDieMethod · 0.80
Uint64OrDieMethod · 0.80
StringOrDieMethod · 0.80
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected