temporary
This commit is contained in:
+14
-2
@@ -23,24 +23,36 @@ type dataCursor struct {
|
||||
currentFunc Functor
|
||||
}
|
||||
|
||||
func newDataCursor(ctx ExprContext) (dc *dataCursor) {
|
||||
dc = &dataCursor{
|
||||
index: -1,
|
||||
ctx: ctx.Clone(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (dc *dataCursor) String() string {
|
||||
return "$(...)"
|
||||
}
|
||||
|
||||
func (dc *dataCursor) Current() (item any, err error) { // must return io.EOF at the last item
|
||||
if item, err = dc.currentFunc.Invoke(dc.ctx, currentName, []any{}); err == nil && item == nil {
|
||||
ctx := cloneContext(dc.ctx)
|
||||
if item, err = dc.currentFunc.Invoke(ctx, currentName, []any{}); err == nil && item == nil {
|
||||
err = io.EOF
|
||||
}
|
||||
exportObjects(dc.ctx, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (dc *dataCursor) Next() (item any, err error) { // must return io.EOF after the last item
|
||||
if item, err = dc.nextFunc.Invoke(dc.ctx, nextName, []any{}); err == nil {
|
||||
ctx := cloneContext(dc.ctx)
|
||||
if item, err = dc.nextFunc.Invoke(ctx, nextName, []any{}); err == nil {
|
||||
if item == nil {
|
||||
err = io.EOF
|
||||
} else {
|
||||
dc.index++
|
||||
}
|
||||
exportObjects(dc.ctx, ctx)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user