yq/pkg/yqlib/operator_column.go

21 lines
505 B
Go
Raw Normal View History

2022-02-27 00:56:46 +00:00
package yqlib
import (
"container/list"
"fmt"
)
func columnOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
log.Debugf("columnOperator")
var results = list.New()
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
candidate := el.Value.(*CandidateNode)
result := candidate.CreateReplacement(ScalarNode, "!!int", fmt.Sprintf("%v", candidate.Column))
2022-02-27 00:56:46 +00:00
results.PushBack(result)
}
return context.ChildContext(results), nil
}