conv

package
v0.0.0-...-738d89c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(exp string, env any, opts ...expr.Option) (any, error)

Eval simulate to expr.Eval, but support more types

func EvaluateExpression

func EvaluateExpression(exp string, vars any, opts ...expr.Option) (any, error)

EvaluateExpression try evaluating an expression,if expression is a static value,vars should nil.

Expressions always start with an equals sign (=). For example, = order.amount > 100. The text following the equal sign is the actual expression. For example, order.amount > 100 checks if the amount of the order is greater than 100.

If the element does not start with the prefix, it is used as a static value. A static value is used either as a string (e.g. job type) or as a number (e.g. job retries). A string value must not be enclosed in quotes.

func EvaluateExpressionToInt

func EvaluateExpressionToInt(exp string, vars any) (int, error)

Types

type DefaultConverter

type DefaultConverter struct {
}

DefaultConverter use expr as evaluate expression engine

func NewDefaultConverter

func NewDefaultConverter() *DefaultConverter

func (*DefaultConverter) ConvertDecisionTable

func (d *DefaultConverter) ConvertDecisionTable(decisionID string, dt *dmn.DecisionTable) ([]string, error)

func (*DefaultConverter) Eval

func (d *DefaultConverter) Eval(rule string, input vars.Mapping) (any, error)

func (*DefaultConverter) Match

func (d *DefaultConverter) Match(rule string, input vars.Mapping) (bool, error)

Jump to

Keyboard shortcuts

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