Documentation
¶
Index ¶
- Constants
- func Compile(source string) error
- func EvaluateArray[ReturnType any](ctx context.Context, logger kitlog.Logger, source string, subject any, ...) ([]ReturnType, error)
- func EvaluateJavascript(ctx context.Context, logger kitlog.Logger, source string, subject any, ...) (result otto.Value, err error)
- func EvaluateResultType[ReturnType any](ctx context.Context, logger kitlog.Logger, source string, result otto.Value) (*ReturnType, error)
- func EvaluateSingleValue[ReturnType any](ctx context.Context, logger kitlog.Logger, source string, subject any, ...) (*ReturnType, error)
- func SafelyGo(do func())
Constants ¶
View Source
const DefaultJSTimeout = 250 * time.Millisecond
DefaultJSTimeout is the default per-evaluation timeout applied when callers don't specify their own. Exposed as a constant so the CLI and tests can share the value.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶ added in v2.13.0
Compile checks that source is valid Javascript without running it. Evaluation swallows errors, so this is the only way to catch a broken expression before it syncs as nil.
func EvaluateArray ¶
func EvaluateJavascript ¶
func EvaluateJavascript(ctx context.Context, logger kitlog.Logger, source string, subject any, timeout time.Duration) (result otto.Value, err error)
EvaluateJavascript can evaluate a source Javascript program having set the given subject into the `$` variable. Evaluation is bounded by timeout; if it elapses, the underlying Otto VM is interrupted and the call surfaces as a panic.
func EvaluateResultType ¶
func EvaluateSingleValue ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.