int-iterator is now defined interval
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/types"
|
||||
"git.portale-stac.it/go-pkg/expr/types/interval"
|
||||
)
|
||||
|
||||
type IntIterator struct {
|
||||
@@ -21,6 +22,16 @@ type IntIterator struct {
|
||||
step int64
|
||||
}
|
||||
|
||||
func NewIntIteratorFromInterval(p *interval.IntervalType) (it *IntIterator, err error) {
|
||||
b := p.Begin()
|
||||
e := p.End()
|
||||
s := p.Step()
|
||||
if b > e {
|
||||
s = -s
|
||||
}
|
||||
return NewIntIteratorA(b, e, s)
|
||||
}
|
||||
|
||||
func NewIntIteratorA(args ...any) (it *IntIterator, err error) {
|
||||
return NewIntIterator(args)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user