moved a subset of source file to the kern package
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
||||
// All rights reserved.
|
||||
|
||||
// iterator.go
|
||||
package kern
|
||||
|
||||
import (
|
||||
// "errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Operator names
|
||||
|
||||
const (
|
||||
InitName = "init"
|
||||
CleanName = "clean"
|
||||
ResetName = "reset"
|
||||
NextName = "next"
|
||||
CurrentName = "current"
|
||||
IndexName = "index"
|
||||
CountName = "count"
|
||||
FilterName = "filter"
|
||||
MapName = "map"
|
||||
KeyName = "key"
|
||||
ValueName = "value"
|
||||
)
|
||||
|
||||
type Iterator interface {
|
||||
Typer
|
||||
fmt.Stringer
|
||||
Next() (item any, err error) // must return io.EOF after the last item
|
||||
Current() (item any, err error)
|
||||
Index() int
|
||||
Count() int
|
||||
HasOperation(name string) bool
|
||||
CallOperation(name string, args map[string]any) (value any, err error)
|
||||
}
|
||||
|
||||
type ExtIterator interface {
|
||||
Iterator
|
||||
Reset() error
|
||||
Clean() error
|
||||
}
|
||||
|
||||
func ErrNoOperation(name string) error {
|
||||
return fmt.Errorf("no %s() function defined in the data-source", name)
|
||||
}
|
||||
Reference in New Issue
Block a user