Upgrade dependent version: github.com/open-policy-agent/opa (#5315)
Upgrade dependent version: github.com/open-policy-agent/opa v0.18.0 -> v0.45.0 Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
26
vendor/github.com/open-policy-agent/opa/util/compare.go
generated
vendored
26
vendor/github.com/open-policy-agent/opa/util/compare.go
generated
vendored
@@ -14,7 +14,7 @@ import (
|
||||
// Compare returns 0 if a equals b, -1 if a is less than b, and 1 if b is than a.
|
||||
//
|
||||
// For comparison between values of different types, the following ordering is used:
|
||||
// nil < bool < float64 < string < []interface{} < map[string]interface{}. Slices and maps
|
||||
// nil < bool < int, float64 < string < []interface{} < map[string]interface{}. Slices and maps
|
||||
// are compared recursively. If one slice or map is a subset of the other slice or map
|
||||
// it is considered "less than". Nil is always equal to nil.
|
||||
//
|
||||
@@ -45,6 +45,26 @@ func Compare(a, b interface{}) int {
|
||||
case json.Number:
|
||||
return compareJSONNumber(a, b)
|
||||
}
|
||||
case int:
|
||||
switch b := b.(type) {
|
||||
case int:
|
||||
if a == b {
|
||||
return 0
|
||||
} else if a < b {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
case float64:
|
||||
switch b := b.(type) {
|
||||
case float64:
|
||||
if a == b {
|
||||
return 0
|
||||
} else if a < b {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
case string:
|
||||
switch b := b.(type) {
|
||||
case string:
|
||||
@@ -150,6 +170,10 @@ func sortOrder(v interface{}) int {
|
||||
return boolSort
|
||||
case json.Number:
|
||||
return numberSort
|
||||
case int:
|
||||
return numberSort
|
||||
case float64:
|
||||
return numberSort
|
||||
case string:
|
||||
return stringSort
|
||||
case []interface{}:
|
||||
|
||||
Reference in New Issue
Block a user