expression

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Env = map[string]any{
	"debug": func(ctx context.Context, v any) any {
		flog.Info("[expr] Debug: %+v", v)
		return true
	},
}
View Source
var Lib = map[string]any{
	"toInt": func(v any) int { return v.(int) + 1000 },
}

Functions

func Compile

func Compile(code string) (*vm.Program, error)

func LoadLib

func LoadLib(name string, f any)

func NewEnv

func NewEnv(ctx context.Context, val map[string]any) map[string]any

func Run

func Run(program *vm.Program) (interface{}, error)

Types

type Env2

type Env2 struct {
	Ctx   context.Context `expr:"ctx"`
	Input map[string]any  `expr:"input"`
	Lib   map[string]any  `expr:"lib"`
}

Jump to

Keyboard shortcuts

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