yq/pkg/yqlib/operator_parent.go

20 lines
438 B
Go
Raw Normal View History

2021-11-23 23:16:48 +00:00
package yqlib
import "container/list"
2024-01-11 02:17:34 +00:00
func getParentOperator(_ *dataTreeNavigator, context Context, _ *ExpressionNode) (Context, error) {
2021-11-23 23:16:48 +00:00
log.Debugf("-- getParentOperator")
var results = list.New()
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
candidate := el.Value.(*CandidateNode)
if candidate.Parent != nil {
results.PushBack(candidate.Parent)
}
}
return context.ChildContext(results), nil
}