Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("script execution timeout")
Functions ¶
Types ¶
type Assignment ¶
type Result ¶
type Result struct {
// JSON compatible value: nil, bool, float64, string, []any or map[string]any (EXPR-05)
Value any
Logs []string
Assignments []Assignment
}
type Sandbox ¶
Sandbox evaluates JavaScript, the only expression and script language of the engine (EXPR-01). Scripts see the variables as globals plus log(...) and setVariable(name, value) (EXPR-04). They have no access to engine internals, the file system or the network, because goja provides none of these by default and nothing else is registered (EXPR-03).
goja has no memory limit. The timeout and the result size limit bound what a script can do, but a script can allocate memory until the timeout interrupts it.
func NewSandbox ¶
func NewSandbox() *Sandbox