compareValues 比较值
(actual any, operator string, expected any)
| 702 | |
| 703 | // compareValues 比较值 |
| 704 | func (ac *AccessController) compareValues(actual any, operator string, expected any) bool { |
| 705 | actualStr := fmt.Sprintf("%v", actual) |
| 706 | expectedStr := fmt.Sprintf("%v", expected) |
| 707 | |
| 708 | switch operator { |
| 709 | case "eq": |
| 710 | return actualStr == expectedStr |
| 711 | case "ne": |
| 712 | return actualStr != expectedStr |
| 713 | case "in": |
| 714 | return ac.valueInList(actualStr, expected) |
| 715 | default: |
| 716 | return false |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | // valueInList 检查值是否在列表中 |
| 721 | func (ac *AccessController) valueInList(value string, list any) bool { |
no test coverage detected