CallFunction() has been replaced by three new functions:
CallFunctionByTerm(), CallFunctionByArgs() and CallFunctionByParams()
This commit is contained in:
+5
-6
@@ -108,7 +108,7 @@ func (dc *dataCursor) Reset() (success bool, err error) {
|
||||
if dc.resetFunc != nil {
|
||||
if dc.resource != nil {
|
||||
ctx := cloneContext(dc.ctx)
|
||||
actualParams := buildActualParams(dc.resetFunc, []any{dc.resource})
|
||||
actualParams := bindActualParams(dc.resetFunc, []any{dc.resource})
|
||||
_, err = dc.resetFunc.InvokeNamed(ctx, ResetName, actualParams)
|
||||
exportObjects(dc.ctx, ctx)
|
||||
dc.index = -1
|
||||
@@ -131,7 +131,7 @@ func (dc *dataCursor) Clean() (success bool, err error) {
|
||||
if dc.cleanFunc != nil {
|
||||
if dc.resource != nil {
|
||||
ctx := cloneContext(dc.ctx)
|
||||
actualParams := buildActualParams(dc.cleanFunc, []any{dc.resource})
|
||||
actualParams := bindActualParams(dc.cleanFunc, []any{dc.resource})
|
||||
_, err = dc.cleanFunc.InvokeNamed(ctx, CleanName, actualParams)
|
||||
// dc.resource = nil
|
||||
exportObjects(dc.ctx, ctx)
|
||||
@@ -161,7 +161,7 @@ func (dc *dataCursor) checkFilter(filter Functor, item any) (accepted bool, err
|
||||
var ok bool
|
||||
ctx := cloneContext(dc.ctx)
|
||||
|
||||
actualParams := buildActualParams(filter, []any{item, dc.index})
|
||||
actualParams := bindActualParams(filter, []any{item, dc.index})
|
||||
if v, err = filter.InvokeNamed(ctx, FilterName, actualParams); err == nil && v != nil {
|
||||
if accepted, ok = v.(bool); !ok {
|
||||
accepted = true // NOTE: A non-boolean value that is not nil means the item has been accepted
|
||||
@@ -172,7 +172,7 @@ func (dc *dataCursor) checkFilter(filter Functor, item any) (accepted bool, err
|
||||
|
||||
func (dc *dataCursor) mapItem(mapper Functor, item any) (mappedItem any, err error) {
|
||||
ctx := cloneContext(dc.ctx)
|
||||
actualParams := buildActualParams(mapper, []any{item, dc.index})
|
||||
actualParams := bindActualParams(mapper, []any{item, dc.index})
|
||||
mappedItem, err = mapper.InvokeNamed(ctx, MapName, actualParams)
|
||||
return
|
||||
}
|
||||
@@ -199,7 +199,7 @@ func (dc *dataCursor) Next() (current any, err error) { // must return io.EOF af
|
||||
ctx := cloneContext(dc.ctx)
|
||||
dc.index++
|
||||
|
||||
actualParams := buildActualParams(dc.nextFunc, []any{dc.resource, dc.index})
|
||||
actualParams := bindActualParams(dc.nextFunc, []any{dc.resource, dc.index})
|
||||
if item, dc.lastErr = dc.nextFunc.InvokeNamed(ctx, NextName, actualParams); dc.lastErr == nil {
|
||||
if item == nil {
|
||||
dc.lastErr = io.EOF
|
||||
@@ -238,4 +238,3 @@ func (dc *dataCursor) Index() int {
|
||||
func (dc *dataCursor) Count() int {
|
||||
return dc.count
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user