MCPcopy Create free account
hub / github.com/cel-expr/cel-go / refValueToExprValue

Function refValueToExprValue

conformance/conformance_test.go:131–146  ·  view source on GitHub ↗
(res ref.Val)

Source from the content-addressed store, hash-verified

129}
130
131func refValueToExprValue(res ref.Val) (*valuepb.ExprValue, error) {
132 if types.IsUnknown(res) {
133 return &valuepb.ExprValue{
134 Kind: &valuepb.ExprValue_Unknown{
135 Unknown: &valuepb.UnknownSet{
136 Exprs: res.Value().([]int64),
137 },
138 }}, nil
139 }
140 v, err := cel.ValueAsProto(res)
141 if err != nil {
142 return nil, err
143 }
144 return &valuepb.ExprValue{
145 Kind: &valuepb.ExprValue_Value{Value: v}}, nil
146}
147
148func exprValueToRefValue(adapter types.Adapter, ev *valuepb.ExprValue) (ref.Val, error) {
149 switch ev.Kind.(type) {

Callers 1

conformanceTestFunction · 0.70

Calls 3

IsUnknownFunction · 0.92
ValueAsProtoFunction · 0.92
ValueMethod · 0.65

Tested by

no test coverage detected