cel

package
v1.9.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cel provides helpers for working with CEL expressions.

Index

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) EvalBool

func (expr Expression) EvalBool(env *cel.Env, values map[string]any) (bool, error)

EvalBool evaluates the expression in the given environment.

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.

Directories

Path Synopsis
Package celenv provides standard CEL environments to evaluate CEL expressions.
Package celenv provides standard CEL environments to evaluate CEL expressions.

Jump to

Keyboard shortcuts

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