func (c *Config) Filter(list []unstructured.Unstructured) ([]unstructured.Unstructured, error) {
	var (
		tree tsl.Node
		err  error
	)
	tree, err = tsl.ParseTSL(c.Query)
	if err != nil {
		return nil, err
	}
	tree, err = ident.Walk(tree, c.CheckColumnName)
	if err != nil {
		return nil, err
	}
	items := []unstructured.Unstructured{}
	for _, item := range list {
		matchingFilter, err := semantics.Walk(tree, eval.Factory(item))
		if err != nil {
			continue
		}
		if !matchingFilter {
			continue
		}
		items = append(items, item)
	}
	return items, nil
}
Filter filters items using query.
package filter
import (
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"github.com/yaacov/tree-search-language/v5/pkg/tsl"
	"github.com/yaacov/tree-search-language/v5/pkg/walkers/ident"
	"github.com/yaacov/tree-search-language/v5/pkg/walkers/semantics"
	"github.com/yaacov/kubectl-sql/pkg/eval"
)
type Config struct {
	CheckColumnName func(s string) (string, error)
	Query           string
	Prefix1 string
	Prefix2 string
	Item    unstructured.Unstructured
}