report prints out the result of evaluation in human-friendly terms.
(result ref.Val, details *cel.EvalDetails, err error)
| 194 | |
| 195 | // report prints out the result of evaluation in human-friendly terms. |
| 196 | func report(result ref.Val, details *cel.EvalDetails, err error) { |
| 197 | fmt.Println("------ result ------") |
| 198 | if err != nil { |
| 199 | fmt.Printf("error: %s\n", err) |
| 200 | } else { |
| 201 | fmt.Printf("value: %v (%T)\n", result, result) |
| 202 | } |
| 203 | if details != nil { |
| 204 | fmt.Printf("\n------ eval states ------\n") |
| 205 | state := details.State() |
| 206 | stateIDs := state.IDs() |
| 207 | ids := make([]int, len(stateIDs), len(stateIDs)) |
| 208 | for i, id := range stateIDs { |
| 209 | ids[i] = int(id) |
| 210 | } |
| 211 | sort.Ints(ids) |
| 212 | for _, id := range ids { |
| 213 | v, found := state.Value(int64(id)) |
| 214 | if !found { |
| 215 | continue |
| 216 | } |
| 217 | fmt.Printf("%d: %v (%T)\n", id, v, v) |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // mapContainsKeyValue implements the custom function: |
| 223 | // |