Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BindingsType = cel.OpaqueType("bindings") BaseEnv = sync.OnceValues(func() (*cel.Env, error) { return cel.NewEnv( cel.Variable("object", cel.DynType), cel.Variable("bindings", BindingsType), cel.Function("resolve", cel.MemberOverload("bindings_resolve_string", []*cel.Type{BindingsType, cel.StringType}, cel.AnyType, cel.BinaryBinding(func(lhs, rhs ref.Val) ref.Val { bindings, ok := lhs.(Val[binding.Bindings]) if !ok { return types.ValOrErr(bindings, "invalid bindings type") } name, ok := rhs.(types.String) if !ok { return types.ValOrErr(name, "invalid name type") } value, err := binding.Resolve("$"+string(name), bindings.Unwrap()) if err != nil { return types.WrapErr(err) } return types.DefaultTypeAdapter.NativeToValue(value) }), ), ), ) }) DefaultEnv = sync.OnceValues(func() (*cel.Env, error) { if env, err := BaseEnv(); err != nil { return nil, err } else if env, err := env.Extend( cel.HomogeneousAggregateLiterals(), cel.EagerlyValidateDeclarations(true), cel.DefaultUTCTimeZone(true), cel.CrossTypeNumericComparisons(true), cel.OptionalTypes(), ext.Strings(), ext.Sets(), ); err != nil { return nil, err } else { return env, nil } }) )
Functions ¶
func NewCompiler ¶
Types ¶
type Val ¶
type Val[T comparable] struct { // contains filtered or unexported fields }
func (Val[T]) ConvertToNative ¶
Click to show internal directories.
Click to hide internal directories.