data-cursor.go: fixed filter

This commit is contained in:
2024-07-13 00:12:08 +02:00
parent a02f998fc6
commit 8547248ea2
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -166,9 +166,8 @@ func (dc *dataCursor) filter(item any) (filterdItem any, err error) {
func (dc *dataCursor) Next() (item any, err error) { // must return io.EOF after the last item
if dc.resource != nil {
ctx := cloneContext(dc.ctx)
// fmt.Printf("Entering Inner-Ctx [%p]: %s\n", ctx, CtxToString(ctx, 0))
for item == nil && err == nil {
ctx := cloneContext(dc.ctx)
if item, err = dc.nextFunc.Invoke(ctx, nextName, []any{dc.resource}); err == nil {
if item == nil {
err = io.EOF
@@ -177,10 +176,8 @@ func (dc *dataCursor) Next() (item any, err error) { // must return io.EOF after
item, err = dc.filter(item)
}
}
exportObjects(dc.ctx, ctx)
}
// fmt.Printf("Exiting Inner-Ctx [%p]: %s\n", ctx, CtxToString(ctx, 0))
exportObjects(dc.ctx, ctx)
// fmt.Printf("Outer-Ctx [%p]: %s\n", dc.ctx, CtxToString(dc.ctx, 0))
} else {
err = errInvalidDataSource()
}