mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-15 07:38:14 +00:00
62d167c141
* Variable loop wip * Variable loop wip * Variable loop wip * Variable loop wip * Fixed variable operator to work like jq
19 lines
512 B
Go
19 lines
512 B
Go
package yqlib
|
|
|
|
func pipeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
|
|
if expressionNode.LHS.Operation.OperationType == assignVariableOpType {
|
|
return variableLoop(d, context, expressionNode)
|
|
}
|
|
|
|
lhs, err := d.GetMatchingNodes(context, expressionNode.LHS)
|
|
if err != nil {
|
|
return Context{}, err
|
|
}
|
|
rhs, err := d.GetMatchingNodes(lhs, expressionNode.RHS)
|
|
if err != nil {
|
|
return Context{}, err
|
|
}
|
|
return context.ChildContext(rhs.MatchingNodes), nil
|
|
}
|