Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All() celexp.ExtFunctionList
All returns a combined list of all CEL extension functions, including both built-in extensions from google/cel-go and custom extensions implemented in this project.
Note: debug.DebugOutFunc is NOT included here because it requires a Writer parameter for output. Use debug.DebugOutFunc(w) separately when building environments that need debug.out functionality.
Example usage:
funcs := ext.All()
err := ext.SetFunctionNames(funcs)
if err != nil {
return err
}
// Now you have all functions with their FunctionNames populated
func BuiltIn ¶
func BuiltIn() celexp.ExtFunctionList
BuiltIn returns a list of built-in CEL extension functions provided by the google/cel-go library. These include extensions for strings, lists, bindings, encoders, math, protos, sets, and various CEL options.
Example usage:
funcs := ext.BuiltIn()
for _, f := range funcs {
fmt.Printf("Extension: %s (%s)\n", f.Name, f.Description)
}
func Custom ¶
func Custom() celexp.ExtFunctionList
Custom returns a list of custom CEL extension functions implemented in this project. These are functions with Custom=true that extend CEL with project-specific functionality like arrays, strings, filepath, guid, map, marshalling, debugging, sorting, and time operations.
Note: debug.DebugOutFunc is NOT included here because it requires a Writer parameter for output. Use debug.DebugOutFunc(w) separately when building environments that need debug.out functionality.
Example usage:
funcs := ext.Custom()
for _, f := range funcs {
fmt.Printf("Custom Function: %s (%s)\n", f.Name, f.Description)
}
func HomogeneousAggregateLiteralsEnabled ¶
func HomogeneousAggregateLiteralsEnabled() bool
HomogeneousAggregateLiteralsEnabled returns whether the HomogeneousAggregateLiterals CEL option is currently enabled.
func SetFunctionNames ¶
func SetFunctionNames(funcs celexp.ExtFunctionList) error
SetFunctionNames populates the FunctionNames field for each ExtFunction in the list by creating a CEL environment with the EnvOptions and extracting the function names from the environment's function declarations. It compares the functions in the environment with the EnvOptions against a baseline environment to identify which functions are added by the specific extension.
Example usage:
funcs := ext.GetCelExtFunctions()
err := ext.SetFunctionNames(funcs)
if err != nil {
return err
}
// Now funcs[i].FunctionNames will be populated with the function names
// for each extension, e.g., ["charAt", "indexOf", "replace", ...] for strings
func SetHomogeneousAggregateLiterals ¶
func SetHomogeneousAggregateLiterals(enabled bool)
SetHomogeneousAggregateLiterals enables or disables the HomogeneousAggregateLiterals CEL option. When enabled, CEL enforces that all elements in list literals and all values in map literals must be the same type at compile time.
This is disabled by default because configuration data is inherently heterogeneous (maps naturally have mixed-type values like strings, numbers, booleans), and dynamic variables (forEach aliases, resolver references) produce 'dyn' types that conflict with concrete types like 'string' when used in the same map literal.
Enable this if you want stricter type checking and are willing to wrap values in dyn() to ensure type homogeneity.
Types ¶
This section is empty.