Files
path/equal.go

21 lines
403 B
Go
Raw Permalink Normal View History

2023-04-20 18:01:36 +00:00
package path
import "time"
func Equal(obj any, path string, matchStr string) (bool, error) {
return op(obj, path, matchStr, equal)
}
func equal(obj, match any, _ string) bool {
switch objt := obj.(type) {
case time.Time:
tm := match.(*timeVal)
// TODO: Replace Truncate() with a timezone-aware version
return tm.time.Equal(objt.Truncate(tm.precision))
default:
return obj == match
}
}