cel

package
v1.8.40 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

nolint

copy https://github.com/jweny/pocassist/blob/master/pkg/cel/cel.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(env *cel.Env, expression string, params map[string]interface{}) (ref.Val, error)

计算单个表达式

Types

type CelController

type CelController struct {
	Env      *cel.Env               // cel env
	ParamMap map[string]interface{} // 注入到cel中的变量
	Option   CustomLib              //
}

func (*CelController) Evaluate

func (cc *CelController) Evaluate(char string) (bool, error)

计算cel表达式

func (*CelController) InitCel

func (celController *CelController) InitCel(poc *xray.Poc) error

初始化env

func (*CelController) InitSet

func (cc *CelController) InitSet(poc *xray.Poc, newReq *proto.Request) (err error)

处理poc: set

func (*CelController) UpdateEnv

func (cc *CelController) UpdateEnv()

func (*CelController) UpdateRule

func (cc *CelController) UpdateRule(ruleName string, ruleResult bool)

type CustomLib

type CustomLib struct {
	// contains filtered or unexported fields
}

func InitCelOptions

func InitCelOptions() CustomLib

func (*CustomLib) AddRuleSetOptions

func (c *CustomLib) AddRuleSetOptions(args []yaml.MapItem)

如果有set:追加set变量到 cel options

func (*CustomLib) CompileOptions

func (c *CustomLib) CompileOptions() []cel.EnvOption

func (*CustomLib) ProgramOptions

func (c *CustomLib) ProgramOptions() []cel.ProgramOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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