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

Function DurationFromValue

eval/public/structs/cel_proto_wrap_util.cc:725–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723}
724
725google::protobuf::Message* DurationFromValue(const google::protobuf::Message* prototype,
726 const CelValue& value,
727 google::protobuf::Arena* arena) {
728 absl::Duration val;
729 if (!value.GetValue(&val)) {
730 return nullptr;
731 }
732 if (!cel::internal::ValidateDuration(val).ok()) {
733 return nullptr;
734 }
735 auto* message = prototype->New(arena);
736 CEL_ASSIGN_OR_RETURN(
737 auto reflection,
738 cel::well_known_types::GetDurationReflection(message->GetDescriptor()),
739 _.With(IgnoreErrorAndReturnNullptr()));
740 reflection.UnsafeSetFromAbslDuration(message, val);
741 return message;
742}
743
744google::protobuf::Message* BoolFromValue(const google::protobuf::Message* prototype,
745 const CelValue& value, google::protobuf::Arena* arena) {

Callers 1

MaybeWrapMessageMethod · 0.85

Calls 5

ValidateDurationFunction · 0.85
GetValueMethod · 0.45
okMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected