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

Function refValueToExprValue

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

Source from the content-addressed store, hash-verified

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