Add lte and gte
Co-authored-by: Crow Crowcrow <crow@fuyu.moe> Co-committed-by: Crow Crowcrow <crow@fuyu.moe>
This commit is contained in:
parent
84ee3011ac
commit
7405c824fe
2 changed files with 73 additions and 21 deletions
22
rules.go
22
rules.go
|
@ -90,6 +90,28 @@ var funcs = map[string]listFuncInfo{
|
|||
}},
|
||||
|
||||
// Integers
|
||||
`gte`: {InputSame, Kinds{
|
||||
reflect.Int: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Int() >= val.(int64)
|
||||
},
|
||||
reflect.Uint: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Uint() >= val.(uint64)
|
||||
},
|
||||
reflect.Float64: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Float() >= val.(float64)
|
||||
},
|
||||
}},
|
||||
`lte`: {InputSame, Kinds{
|
||||
reflect.Int: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Int() <= val.(int64)
|
||||
},
|
||||
reflect.Uint: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Uint() <= val.(uint64)
|
||||
},
|
||||
reflect.Float64: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Float() <= val.(float64)
|
||||
},
|
||||
}},
|
||||
`gt`: {InputSame, Kinds{
|
||||
reflect.Int: func(rv reflect.Value, val interface{}) bool {
|
||||
return rv.Int() > val.(int64)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue