yq/pkg/yqlib/operator_split_document.go

16 lines
389 B
Go
Raw Permalink Normal View History

2021-01-14 03:25:31 +00:00
package yqlib
2024-01-11 02:17:34 +00:00
func splitDocumentOperator(_ *dataTreeNavigator, context Context, _ *ExpressionNode) (Context, error) {
2024-02-15 22:41:33 +00:00
log.Debugf("splitDocumentOperator")
2021-01-14 03:25:31 +00:00
var index uint
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
2021-01-14 03:25:31 +00:00
candidate := el.Value.(*CandidateNode)
candidate.SetDocument(index)
candidate.SetParent(nil)
2021-01-14 03:25:31 +00:00
index = index + 1
}
return context, nil
2021-01-14 03:25:31 +00:00
}