goscripts

package module
v0.0.0-...-ed1408d Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package goscripts 把 go-scripts 接入 go-wind-flow 的 SPI:

  • Runner:实现 flow.ScriptRunner,驱动脚本任务(JS/Lua/Python/Go/...);
  • Evaluator:实现 flow.ExpressionEvaluator(复用 go-scripts 的 CEL/Expr 引擎)。

沙箱约定:脚本环境只注入实例变量与白名单宿主函数;执行经 context deadline 控时。生产高并发建议在宿主侧为 Runner 包一层引擎池。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Evaluator

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

Evaluator flow.ExpressionEvaluator 的 go-scripts 实现(CEL 或 Expr 引擎)。

func NewCELEvaluator

func NewCELEvaluator() *Evaluator

NewCELEvaluator 用 go-scripts 的 CEL 引擎求值。

func NewExprEvaluator

func NewExprEvaluator() *Evaluator

NewExprEvaluator 用 go-scripts 的 Expr 引擎求值。

func (*Evaluator) EvalBool

func (e *Evaluator) EvalBool(ctx context.Context, expression string, env flow.Vars) (bool, error)

type Runner

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

Runner flow.ScriptRunner 的 go-scripts 实现。

func New

func New() *Runner

New 创建 Runner。langs 省略时按需懒加载。

func (*Runner) Close

func (r *Runner) Close() error

Close 关闭全部引擎。

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, spec *flow.ScriptSpec, env flow.Vars) (any, error)

Run 执行脚本任务。脚本可通过 return 返回 map[string]any 合并进实例变量。

Jump to

Keyboard shortcuts

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