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

Function TimestampFromValue

eval/public/structs/cel_proto_wrap_util.cc:860–877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

858}
859
860google::protobuf::Message* TimestampFromValue(const google::protobuf::Message* prototype,
861 const CelValue& value,
862 google::protobuf::Arena* arena) {
863 absl::Time val;
864 if (!value.GetValue(&val)) {
865 return nullptr;
866 }
867 if (!cel::internal::ValidateTimestamp(val).ok()) {
868 return nullptr;
869 }
870 auto* message = prototype->New(arena);
871 CEL_ASSIGN_OR_RETURN(
872 auto reflection,
873 cel::well_known_types::GetTimestampReflection(message->GetDescriptor()),
874 _.With(IgnoreErrorAndReturnNullptr()));
875 reflection.UnsafeSetFromAbslTime(message, val);
876 return message;
877}
878
879google::protobuf::Message* UInt32FromValue(const google::protobuf::Message* prototype,
880 const CelValue& value, google::protobuf::Arena* arena) {

Callers 1

MaybeWrapMessageMethod · 0.85

Calls 5

ValidateTimestampFunction · 0.85
UnsafeSetFromAbslTimeMethod · 0.80
GetValueMethod · 0.45
okMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected