Documentation
¶
Index ¶
- type Builder
- func AddBinaryFunc[A any, B any, Out any](b *Builder, name string, impl func(context.Context, A, B) (Out, error)) *Builder
- func AddUnaryFunc[In any, Out any](b *Builder, name string, impl func(context.Context, In) (Out, error)) *Builder
- func AddZeroFunc[Out any](b *Builder, name string, impl func(context.Context) (Out, error)) *Builder
- func AddZeroFuncWithContext[Out any](b *Builder, name string, ...) *Builder
- func NewBuilder() *Builder
- func (b *Builder) FunctionOptions(adapter types.Adapter) ([]cel.EnvOption, error)
- func (b *Builder) FunctionOptionsWithContext(adapter types.Adapter, ctxProvider ContextProvider) ([]cel.EnvOption, error)
- func (b *Builder) TemplateFuncsWithContext(ctxProvider ContextProvider) map[string]interface{}
- func (b *Builder) TypeOptions() []cel.EnvOption
- func (b *Builder) WithBuiltin(name string, factory BuiltinFactory) *Builder
- func (b *Builder) WithDefaults() *Builder
- func (b *Builder) WithTemplateFunc(name string, factory TemplateFuncFactory) *Builder
- type BuiltinFactory
- type CELCell
- type ContextProvider
- type TemplateFuncFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder holds a non-global set of builtin function factories and type declarations.
func AddBinaryFunc ¶
func AddBinaryFunc[A any, B any, Out any](b *Builder, name string, impl func(context.Context, A, B) (Out, error)) *Builder
AddBinaryFunc registers a typed binary function with static typing.
func AddUnaryFunc ¶
func AddUnaryFunc[In any, Out any](b *Builder, name string, impl func(context.Context, In) (Out, error)) *Builder
AddUnaryFunc registers a typed unary function with static output typing.
func AddZeroFunc ¶
func AddZeroFunc[Out any](b *Builder, name string, impl func(context.Context) (Out, error)) *Builder
AddZeroFunc preserves the legacy zero-arg function registration without task context.
func AddZeroFuncWithContext ¶
func AddZeroFuncWithContext[Out any](b *Builder, name string, impl func(context.Context, contextual.TaskExecutionContext) (Out, error)) *Builder
AddZeroFuncWithContext registers a zero-argument function that can access the TaskExecutionContext.
func (*Builder) FunctionOptions ¶
FunctionOptions materializes cel.EnvOptions using the provided adapter.
func (*Builder) FunctionOptionsWithContext ¶
func (b *Builder) FunctionOptionsWithContext(adapter types.Adapter, ctxProvider ContextProvider) ([]cel.EnvOption, error)
FunctionOptionsWithContext materializes cel.EnvOptions using the provided adapter and task context provider.
func (*Builder) TemplateFuncsWithContext ¶
func (b *Builder) TemplateFuncsWithContext(ctxProvider ContextProvider) map[string]interface{}
TemplateFuncsWithContext materializes text/template functions using the current task context provider.
func (*Builder) TypeOptions ¶
TypeOptions returns EnvOptions that must be supplied at env construction time.
func (*Builder) WithBuiltin ¶
func (b *Builder) WithBuiltin(name string, factory BuiltinFactory) *Builder
WithBuiltin registers or overwrites a low-level CEL builtin factory.
This API is intended for advanced CEL-specific integrations. Most callers should use AddZeroFuncWithContext/AddZeroFunc/AddUnaryFunc/AddBinaryFunc to avoid drift between CEL and Go templates. If you use WithBuiltin and need Go-template parity, also register WithTemplateFunc for the same function name.
func (*Builder) WithDefaults ¶
WithDefaults installs the legacy builtin set (json_parse, json_stringify, jq, string overloads).
func (*Builder) WithTemplateFunc ¶
func (b *Builder) WithTemplateFunc(name string, factory TemplateFuncFactory) *Builder
WithTemplateFunc registers or overwrites a low-level Go-template function factory.
This is primarily a companion for advanced WithBuiltin usage. Prefer the typed Add* helpers for regular function registration so both CEL and templates are wired together.
type BuiltinFactory ¶
type BuiltinFactory func(adapter types.Adapter, ctxProvider ContextProvider) cel.EnvOption
BuiltinFactory produces a cel.EnvOption given the adapter (needed for native conversions) and, optionally, a TaskExecutionContext provider for context-aware functions.
Advanced use only: Prefer AddZeroFuncWithContext/AddZeroFunc/AddUnaryFunc/AddBinaryFunc for normal integrations. Those helpers automatically register both CEL and Go-template equivalents. WithBuiltin alone is CEL-only unless paired with WithTemplateFunc.
type CELCell ¶
type CELCell struct {
Name string `json:"name"`
ID string `json:"id"`
Path string `json:"path"`
Description string `json:"description"`
}
CELCell is the canonical shape returned by the cells() helper. Using a defined struct improves schema validation and keeps fields deterministic.
type ContextProvider ¶
type ContextProvider func() contextual.TaskExecutionContext
ContextProvider returns the TaskExecutionContext in scope for the current CEL evaluation. It may be nil when functions are evaluated without a task context (e.g., validation).
type TemplateFuncFactory ¶
type TemplateFuncFactory func(ctxProvider ContextProvider) interface{}