interval: the IN operator can now check if an integer value is inlcuded in a range

This commit is contained in:
2026-08-01 11:22:58 +02:00
parent 6f08176122
commit 481074d104
4 changed files with 19 additions and 2 deletions
+4
View File
@@ -10,6 +10,7 @@ import (
"git.portale-stac.it/go-pkg/expr/sym"
"git.portale-stac.it/go-pkg/expr/types/array"
"git.portale-stac.it/go-pkg/expr/types/dict"
"git.portale-stac.it/go-pkg/expr/types/interval"
"git.portale-stac.it/go-pkg/expr/types/list"
)
@@ -46,6 +47,9 @@ func evalIn(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
} else if list.IsLinkedList(rightValue) {
ls, _ := rightValue.(*list.LinkedList)
v = ls.HasValue(leftValue)
} else if interval.IsInterval(rightValue) {
r, _ := rightValue.(*interval.IntervalType)
v = r.Contains(leftValue)
} else {
err = opTerm.ErrIncompatibleTypes(leftValue, rightValue)
}