func SnippetVersion(s *drghs_v1.SnippetVersion, filter string) (bool, error) {
	if filter == "" {
		filter = defaultFilter
	}
	env, err := cel.NewEnv(
		cel.Types(&drghs_v1.SnippetVersion{}),
		cel.Declarations(
			decls.NewIdent("version", decls.NewObjectType("drghs.v1.SnippetVersion"), nil)))
	parsed, issues := env.Parse(filter)
	if issues != nil && issues.Err() != nil {
		return false, issues.Err()
	}
	checked, issues := env.Check(parsed)
	if issues != nil && issues.Err() != nil {
		return false, issues.Err()
	}
	prg, err := env.Program(checked)
	if err != nil {
		return false, err
	}
	out, _, err := prg.Eval(map[string]interface{}{
		"version": s,
	})
	return out == types.True, err
}
SnippetVersion checks if the SnippetVersion passes the given CEL expression.
package filter
import (
	drghs_v1 "github.com/GoogleCloudPlatform/devrel-services/drghs/v1"
	"github.com/google/cel-go/cel"
	"github.com/google/cel-go/checker/decls"
	"github.com/google/cel-go/common/types"
)
const defaultFilter = "true"
func BuildSnippetFilter(filter string) (cel.Program, error) {
	if filter == "" {
		filter = defaultFilter
	}
	env, err := cel.NewEnv(
		cel.Types(&drghs_v1.Snippet{}),
		cel.Declarations(
			decls.NewIdent("snippet", decls.NewObjectType("drghs.v1.Snippet"), nil),
		))
	if err != nil {
		return nil, err
	}
	parsed, issues := env.Parse(filter)
	if issues != nil && issues.Err() != nil {
		return nil, issues.Err()
	}
	checked, issues := env.Check(parsed)
	if issues != nil && issues.Err() != nil {
		return nil, issues.Err()
	}
	return env.Program(checked)
}
func Snippet(s *drghs_v1.Snippet, p cel.Program) (bool, error) {
	if s == nil || p == nil {
		return false, nil
	}
	out, _, err := p.Eval(map[string]interface{}{
		"snippet": s,
	})
	return out == types.True, err
}