mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
20 lines
538 B
Go
20 lines
538 B
Go
package treeops
|
|
|
|
import "github.com/elliotchance/orderedmap"
|
|
|
|
func UnionOperator(d *dataTreeNavigator, matchingNodes *orderedmap.OrderedMap, pathNode *PathTreeNode) (*orderedmap.OrderedMap, error) {
|
|
lhs, err := d.getMatchingNodes(matchingNodes, pathNode.Lhs)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
rhs, err := d.getMatchingNodes(matchingNodes, pathNode.Rhs)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
for el := rhs.Front(); el != nil; el = el.Next() {
|
|
node := el.Value.(*CandidateNode)
|
|
lhs.Set(node.GetKey(), node)
|
|
}
|
|
return lhs, nil
|
|
}
|