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:
Crow Crowcrow 2021-11-11 10:43:42 +01:00 committed by Nise Void
parent 84ee3011ac
commit 7405c824fe
2 changed files with 73 additions and 21 deletions

View file

@ -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)