1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00
yq/pkg/yqlib/context.go
Mike Farah 7c8d3b9e70 Pass context through operators
Allows more sophisticated functionality
2021-02-03 11:56:35 +11:00

19 lines
441 B
Go

package yqlib
import "container/list"
type Context struct {
MatchingNodes *list.List
Variables map[string]*list.List
}
func (n *Context) SingleChildContext(candidate *CandidateNode) Context {
elMap := list.New()
elMap.PushBack(candidate)
return Context{MatchingNodes: elMap, Variables: n.Variables}
}
func (n *Context) ChildContext(results *list.List) Context {
return Context{MatchingNodes: results, Variables: n.Variables}
}