expressions

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 16 Imported by: 1

README

Expressions support

The expressions support is based on ideas from go-away but with different opinions about how things should be done.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("expressions: not implemented")

Functions

func BotEnvironment added in v1.20.0

func BotEnvironment() (*cel.Env, error)

BotEnvironment creates a new CEL environment, this is the set of variables and functions that are passed into the CEL scope so that Anubis can fail loudly and early when something is invalid instead of blowing up at runtime.

func Compile

func Compile(env *cel.Env, src string) (cel.Program, error)

Compile takes CEL environment and syntax tree then emits an optimized Program for execution.

func Load1 added in v1.21.0

func Load1() float64

func Load5 added in v1.21.0

func Load5() float64

func Load15 added in v1.21.0

func Load15() float64

func New added in v1.20.0

func New(opts ...cel.EnvOption) (*cel.Env, error)

func ThresholdEnvironment added in v1.20.0

func ThresholdEnvironment() (*cel.Env, error)

NewThreshold creates a new CEL environment for threshold checking.

Types

type HTTPHeaders

type HTTPHeaders struct {
	http.Header
}

HTTPHeaders is a type wrapper to expose HTTP headers into CEL programs.

func (HTTPHeaders) Contains

func (h HTTPHeaders) Contains(key ref.Val) ref.Val

func (HTTPHeaders) ConvertToNative

func (h HTTPHeaders) ConvertToNative(typeDesc reflect.Type) (any, error)

func (HTTPHeaders) ConvertToType

func (h HTTPHeaders) ConvertToType(typeVal ref.Type) ref.Val

func (HTTPHeaders) Equal

func (h HTTPHeaders) Equal(other ref.Val) ref.Val

func (HTTPHeaders) Find

func (h HTTPHeaders) Find(key ref.Val) (ref.Val, bool)

func (HTTPHeaders) Get

func (h HTTPHeaders) Get(key ref.Val) ref.Val

func (HTTPHeaders) IsZeroValue

func (h HTTPHeaders) IsZeroValue() bool

func (HTTPHeaders) Iterator

func (h HTTPHeaders) Iterator() traits.Iterator

func (HTTPHeaders) Size

func (h HTTPHeaders) Size() ref.Val

func (HTTPHeaders) Type

func (h HTTPHeaders) Type() ref.Type

func (HTTPHeaders) Value

func (h HTTPHeaders) Value() any

type URLValues

type URLValues struct {
	url.Values
}

URLValues is a type wrapper to expose url.Values into CEL programs.

func (URLValues) Contains

func (u URLValues) Contains(key ref.Val) ref.Val

func (URLValues) ConvertToNative

func (u URLValues) ConvertToNative(typeDesc reflect.Type) (any, error)

func (URLValues) ConvertToType

func (u URLValues) ConvertToType(typeVal ref.Type) ref.Val

func (URLValues) Equal

func (u URLValues) Equal(other ref.Val) ref.Val

func (URLValues) Find

func (u URLValues) Find(key ref.Val) (ref.Val, bool)

func (URLValues) Get

func (u URLValues) Get(key ref.Val) ref.Val

func (URLValues) IsZeroValue

func (u URLValues) IsZeroValue() bool

func (URLValues) Iterator

func (u URLValues) Iterator() traits.Iterator

func (URLValues) Size

func (u URLValues) Size() ref.Val

func (URLValues) Type

func (u URLValues) Type() ref.Type

func (URLValues) Value

func (u URLValues) Value() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL