Pass context through operators

Allows more sophisticated functionality
This commit is contained in:
Mike Farah
2021-02-11 10:58:40 +11:00
parent 3bae44be68
commit c6efd5519b
40 changed files with 439 additions and 434 deletions
+3 -7
View File
@@ -1,18 +1,14 @@
package yqlib
import (
"container/list"
)
func splitDocumentOperator(d *dataTreeNavigator, matchMap *list.List, expressionNode *ExpressionNode) (*list.List, error) {
func splitDocumentOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
log.Debugf("-- splitDocumentOperator")
var index uint = 0
for el := matchMap.Front(); el != nil; el = el.Next() {
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
candidate := el.Value.(*CandidateNode)
candidate.Document = index
index = index + 1
}
return matchMap, nil
return context, nil
}