Iterators now support generic operation interface based on methods HasOperation() and CallOperation().
Also fixed mul() function that called doAdd() instead of doMul().
This commit is contained in:
@@ -4,8 +4,16 @@
|
||||
// iterator.go
|
||||
package expr
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Iterator interface {
|
||||
Next() (item any, err error) // must return io.EOF after the last item
|
||||
Current() (item any, err error)
|
||||
Index() int
|
||||
HasOperation(name string) bool
|
||||
CallOperation(name string, args []any) (value any, err error)
|
||||
}
|
||||
|
||||
func errNoOperation(name string) error {
|
||||
return fmt.Errorf("no %q function defined in the data-source", name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user