mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-14 15:18:06 +00:00
c6efd5519b
Allows more sophisticated functionality
19 lines
614 B
Go
19 lines
614 B
Go
package yqlib
|
|
|
|
func pipeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
|
|
//lhs may update the variable context, we should pass that into the RHS
|
|
// BUT we still return the original context back (see jq)
|
|
// https://stedolan.github.io/jq/manual/#Variable/SymbolicBindingOperator:...as$identifier|...
|
|
|
|
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
|
|
}
|