yq/pkg/yqlib/operator_split_document.go
Mike Farah c6efd5519b Pass context through operators
Allows more sophisticated functionality
2021-02-11 10:58:40 +11:00

15 lines
380 B
Go

package yqlib
func splitDocumentOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
log.Debugf("-- splitDocumentOperator")
var index uint = 0
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
candidate := el.Value.(*CandidateNode)
candidate.Document = index
index = index + 1
}
return context, nil
}