Documentation
¶
Index ¶
- type Environment
- type Registry
- func (r *Registry) CompileOptions() []cel.EnvOption
- func (r *Registry) EnumValue(enumName string) ref.Val
- func (r *Registry) FindIdent(identName string) (ref.Val, bool)
- func (r *Registry) FindStructFieldNames(structType string) ([]string, bool)
- func (r *Registry) FindStructFieldType(structType, fieldName string) (*types.FieldType, bool)
- func (r *Registry) FindStructType(structType string) (*types.Type, bool)
- func (r *Registry) LibraryName() string
- func (r *Registry) NativeToValue(value any) ref.Val
- func (r *Registry) NewValue(typeName string, fields map[string]ref.Val) ref.Val
- func (r *Registry) ProgramOptions() []cel.ProgramOption
- func (r *Registry) RegisterConversion(fun any) error
- func (r *Registry) RegisterFunction(name string, fun interface{}) error
- func (r *Registry) RegisterMethod(name string, fun interface{}) error
- func (r *Registry) RegisterType(refTypes any) error
- func (r *Registry) RegisterVariable(name string, val interface{}) error
- type RegistryOption
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment is a wrapper around CEL environment
func NewEnvironment ¶
func NewEnvironment(opts ...cel.EnvOption) (*Environment, error)
NewEnvironment creates a new CEL environment
func (*Environment) Program ¶
func (e *Environment) Program(src string, opts ...cel.ProgramOption) (cel.Program, error)
Program creates a new CEL program
type Registry ¶ added in v0.3.0
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶ added in v0.3.0
func NewRegistry(libraryName string, opts ...RegistryOption) *Registry
NewRegistry creates adapter new Registry.
func (*Registry) CompileOptions ¶ added in v0.3.0
CompileOptions implements the Library interface method.
func (*Registry) EnumValue ¶ added in v0.3.0
EnumValue returns the numeric value of the given enum value name.
func (*Registry) FindIdent ¶ added in v0.3.0
FindIdent takes adapter qualified identifier name and returns adapter Value if one exists.
func (*Registry) FindStructFieldNames ¶ added in v0.6.0
FindStructFieldNames returns thet field names associated with the type, if the type is found.
func (*Registry) FindStructFieldType ¶ added in v0.5.0
FindStructFieldType returns the field type for a checked type value. Returns false if the field could not be found.
func (*Registry) FindStructType ¶ added in v0.5.0
FindStructType returns the Type give a qualified type name.
func (*Registry) LibraryName ¶ added in v0.3.0
LibraryName implements the Library interface method.
func (*Registry) NativeToValue ¶ added in v0.3.0
NativeToValue converts the input `value` to adapter CEL `ref.Val`.
func (*Registry) NewValue ¶ added in v0.3.0
NewValue creates adapter new type value from adapter qualified name and map of field name to value.
func (*Registry) ProgramOptions ¶ added in v0.3.0
func (r *Registry) ProgramOptions() []cel.ProgramOption
ProgramOptions implements the Library interface method.
func (*Registry) RegisterConversion ¶ added in v0.3.0
RegisterConversion registers adapter conversion function with the registry.
func (*Registry) RegisterFunction ¶ added in v0.3.0
RegisterFunction registers adapter function with the registry.
func (*Registry) RegisterMethod ¶ added in v0.3.0
RegisterMethod registers adapter method with the registry.
func (*Registry) RegisterType ¶ added in v0.3.0
RegisterType registers adapter type with the registry.
func (*Registry) RegisterVariable ¶ added in v0.4.0
RegisterVariable registers adapter value with the registry.
type RegistryOption ¶ added in v0.3.0
type RegistryOption func(*Registry)
func WithTagName ¶ added in v0.4.0
func WithTagName(tagName string) RegistryOption
WithTagName sets the tag name used to convert types to CEL types.
func WithTypeAdapter ¶ added in v0.3.0
func WithTypeAdapter(adapter types.Adapter) RegistryOption
WithTypeAdapter sets the type adapter used to convert types to CEL types.
func WithTypeProvider ¶ added in v0.3.0
func WithTypeProvider(provider types.Provider) RegistryOption
WithTypeProvider sets the type provider used to convert types to CEL types.