Documentation
¶
Overview ¶
Package expr provides CEL (Common Expression Language) functionality for evaluating expressions against file paths and YAML content.
It creates CEL environments with custom functions for:
- File path operations (pathBase, pathDir, pathExt)
- YAML content extraction (yamlPath)
CEL expressions have access to variables:
- `files` (list<string>): All file paths in directory
- `dir` (string): The directory path being processed
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToCELValue ¶
ConvertToCELValue converts a Go value to a CEL value. Handles common YAML types and returns null for unsupported types.
Types ¶
type Environment ¶ added in v0.16.0
type Environment struct {
// contains filtered or unexported fields
}
Environment provides a thread-safe wrapper around a *cel.Env.
func MustNewEnvironment ¶ added in v0.16.0
func MustNewEnvironment(opts ...cel.EnvOption) *Environment
MustNewEnvironment creates a new Environment and panics on error.
func NewEnvironment ¶ added in v0.16.0
func NewEnvironment(opts ...cel.EnvOption) (*Environment, error)
NewEnvironment creates a new Environment.
type LazyProgram ¶ added in v0.26.0
type LazyProgram struct {
// contains filtered or unexported fields
}
LazyProgram provides thread-safe lazy compilation of a CEL expression. The expression is compiled at most once, even when accessed concurrently.
func NewLazyProgram ¶ added in v0.26.0
func NewLazyProgram(expression string, env *Environment) *LazyProgram
NewLazyProgram creates a new LazyProgram that will compile the given expression using the provided environment when Get() is first called.
func (*LazyProgram) Get ¶ added in v0.26.0
func (lp *LazyProgram) Get() (cel.Program, error)
Get returns the compiled program, compiling it on the first call. Subsequent calls return the cached result.
func (*LazyProgram) IsCompiled ¶ added in v0.26.0
func (lp *LazyProgram) IsCompiled() bool
IsCompiled returns true if the program has been compiled.