Documentation ¶
Overview ¶
Package cel provides helpers for working with CEL expressions.
Index ¶
- type Expression
- func (expr Expression) EvalBool(env *cel.Env, values map[string]any) (bool, error)
- func (expr Expression) IsZero() bool
- func (expr Expression) MarshalProto() ([]byte, error)
- func (expr Expression) MarshalText() ([]byte, error)
- func (expr *Expression) ParseBool(env *cel.Env) error
- func (expr *Expression) UnmarshalProto(data []byte) error
- func (expr *Expression) UnmarshalText(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression is a CEL expression that can be marshaled/unmarshaled as part of the resource.
func MustExpression ¶
func MustExpression(expr Expression, err error) Expression
MustExpression panics if the expression cannot be parsed.
func ParseBooleanExpression ¶
func ParseBooleanExpression(expression string, env *cel.Env) (Expression, error)
ParseBooleanExpression parses the expression and asserts the result to boolean.
func (Expression) IsZero ¶
func (expr Expression) IsZero() bool
IsZero returns true if the expression is zero.
func (Expression) MarshalProto ¶
func (expr Expression) MarshalProto() ([]byte, error)
MarshalProto marshals the expression to proto.
func (Expression) MarshalText ¶
func (expr Expression) MarshalText() ([]byte, error)
MarshalText marshals the expression to text.
func (*Expression) ParseBool ¶
func (expr *Expression) ParseBool(env *cel.Env) error
ParseBool parses the expression and asserts the result to boolean.
ParseBoolean can be used after unmarshaling the expression from text.
func (*Expression) UnmarshalProto ¶
func (expr *Expression) UnmarshalProto(data []byte) error
UnmarshalProto unmarshals the expression from proto.
func (*Expression) UnmarshalText ¶
func (expr *Expression) UnmarshalText(data []byte) error
UnmarshalText unmarshals the expression from text.