Module split

This commit is contained in:
Ian Gulliver
2023-04-20 18:01:36 +00:00
parent e0c92c24fb
commit f50e6e228c
30 changed files with 4293 additions and 0 deletions

50
less.go Normal file
View File

@@ -0,0 +1,50 @@
package path
import (
"time"
"cloud.google.com/go/civil"
)
func Less(obj any, path string, matchStr string) (bool, error) {
return op(obj, path, matchStr, less)
}
func less(obj, match any, _ string) bool {
switch objt := obj.(type) {
case int:
return objt < match.(int)
case int64:
return objt < match.(int64)
case uint:
return objt < match.(uint)
case uint64:
return objt < match.(uint64)
case float32:
return objt < match.(float32)
case float64:
return objt < match.(float64)
case string:
return objt < match.(string)
case bool:
return !objt && match.(bool)
case time.Time:
tm := match.(*timeVal)
return objt.Truncate(tm.precision).Before(tm.time)
case civil.Date:
return objt.Before(match.(civil.Date))
default:
panic(obj)
}
}