2020-11-03 23:48:43 +00:00
|
|
|
package yqlib
|
2020-10-17 11:10:47 +00:00
|
|
|
|
2021-02-02 07:17:59 +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 {
|
2021-02-02 07:17:59 +00:00
|
|
|
return Context{}, err
|
2020-10-17 11:10:47 +00:00
|
|
|
}
|
2021-02-02 07:17:59 +00:00
|
|
|
rhs, err := d.GetMatchingNodes(context, expressionNode.Rhs)
|
2020-10-17 11:10:47 +00:00
|
|
|
if err != nil {
|
2021-02-02 07:17:59 +00:00
|
|
|
return Context{}, err
|
2020-10-17 11:10:47 +00:00
|
|
|
}
|
2021-02-02 07:17:59 +00:00
|
|
|
for el := rhs.MatchingNodes.Front(); el != nil; el = el.Next() {
|
2020-10-17 11:10:47 +00:00
|
|
|
node := el.Value.(*CandidateNode)
|
2021-02-02 07:17:59 +00:00
|
|
|
lhs.MatchingNodes.PushBack(node)
|
2020-10-17 11:10:47 +00:00
|
|
|
}
|
|
|
|
return lhs, nil
|
|
|
|
}
|