expr

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RunCount   = metric.NewCounter("ExprRun")
	ErrCount   = metric.NewCounter("ExprErr")
	TrueCount  = metric.NewCounter("ExprTrue")
	FalseCount = metric.NewCounter("ExprFalse")
)
View Source
var (
	RawRunCount = metric.NewCounter("RawExprRun")
	RawErrCount = metric.NewCounter("RawExprErr")
)

Functions

func AsBool

func AsBool(v any) bool

Types

type Expr

type Expr interface {
	Run(env map[string]any) (bool, error)
}

type Program

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

func New

func New(raw RawExpr) *Program

func (*Program) Run

func (p *Program) Run(env map[string]any) (bool, error)

type RawExpr added in v0.4.0

type RawExpr interface {
	Run(env map[string]any) (any, error)
}

type RawProgram added in v0.4.0

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

func MustNewRaw added in v0.4.0

func MustNewRaw(code string) *RawProgram

func NewRaw added in v0.4.0

func NewRaw(code string) (*RawProgram, error)

func (*RawProgram) Run added in v0.4.0

func (p *RawProgram) Run(env map[string]any) (any, error)

Jump to

Keyboard shortcuts

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