report prints out the result of evaluation in human-friendly terms.
(result ref.Val, details *cel.EvalDetails, err error)
| 435 | |
| 436 | // report prints out the result of evaluation in human-friendly terms. |
| 437 | func report(result ref.Val, details *cel.EvalDetails, err error) { |
| 438 | fmt.Println("------ result ------") |
| 439 | if err != nil { |
| 440 | fmt.Printf("error: %s\n", err) |
| 441 | } else { |
| 442 | fmt.Printf("value: %v (%T)\n", result, result) |
| 443 | } |
| 444 | if details != nil { |
| 445 | fmt.Printf("\n------ eval states ------\n") |
| 446 | state := details.State() |
| 447 | stateIDs := state.IDs() |
| 448 | ids := make([]int, len(stateIDs), len(stateIDs)) |
| 449 | for i, id := range stateIDs { |
| 450 | ids[i] = int(id) |
| 451 | } |
| 452 | sort.Ints(ids) |
| 453 | for _, id := range ids { |
| 454 | v, found := state.Value(int64(id)) |
| 455 | if !found { |
| 456 | continue |
| 457 | } |
| 458 | fmt.Printf("%d: %v (%T)\n", id, v, v) |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | // mapContainsKeyValue implements the custom function: |
| 464 | // |