yq/pkg/yqlib/operator_union.go

18 lines
493 B
Go
Raw Normal View History

2020-11-03 23:48:43 +00:00
package yqlib
2020-10-17 11:10:47 +00:00
func unionOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
lhs, err := d.GetMatchingNodes(context, expressionNode.Lhs)
2020-10-17 11:10:47 +00:00
if err != nil {
return Context{}, err
2020-10-17 11:10:47 +00:00
}
rhs, err := d.GetMatchingNodes(context, expressionNode.Rhs)
2020-10-17 11:10:47 +00:00
if err != nil {
return Context{}, err
2020-10-17 11:10:47 +00:00
}
for el := rhs.MatchingNodes.Front(); el != nil; el = el.Next() {
2020-10-17 11:10:47 +00:00
node := el.Value.(*CandidateNode)
lhs.MatchingNodes.PushBack(node)
2020-10-17 11:10:47 +00:00
}
return lhs, nil
}