yq/pkg/yqlib/operator_parent.go

20 lines
435 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) {
2024-02-15 22:41:33 +00:00
log.Debugf("getParentOperator")
2021-11-23 23:16:48 +00:00
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
}