Versions in this module Expand all Collapse all v0 v0.0.1 Oct 23, 2026 Changes in this version + var ErrCapabilityNotSupported = errors.New("script engine: capability not supported by this engine type") + var ErrQuotaExceeded = errors.New("script engine: execution quota exceeded") + func Register(typ Type, f FactoryFunc) error + func SetLogger(l Logger) + func Unregister(typ Type) bool + type AutoGrowEnginePool struct + func NewAutoGrowEnginePool(initialSize, maxSize int, typ Type) (*AutoGrowEnginePool, error) + func NewAutoGrowEnginePoolWithFactory(initialSize, maxSize int, factory EngineFactoryFunc) (*AutoGrowEnginePool, error) + func (p *AutoGrowEnginePool) Acquire() (Engine, error) + func (p *AutoGrowEnginePool) CallFunction(ctx context.Context, name string, args ...any) (any, error) + func (p *AutoGrowEnginePool) ClearError() + func (p *AutoGrowEnginePool) Close() error + func (p *AutoGrowEnginePool) Execute(ctx context.Context) (any, error) + func (p *AutoGrowEnginePool) ExecuteFromKey(ctx context.Context, key string) (any, error) + func (p *AutoGrowEnginePool) ExecuteFromKeys(ctx context.Context, keys []string) ([]any, error) + func (p *AutoGrowEnginePool) ExecuteString(ctx context.Context, name string, code string) (any, error) + func (p *AutoGrowEnginePool) GetGlobal(name string) (any, error) + func (p *AutoGrowEnginePool) GetLastError() error + func (p *AutoGrowEnginePool) GetSource() source.Reader + func (p *AutoGrowEnginePool) Load(ctx context.Context, key string) error + func (p *AutoGrowEnginePool) LoadMulti(ctx context.Context, keys []string) error + func (p *AutoGrowEnginePool) LoadString(ctx context.Context, name string, code string) error + func (p *AutoGrowEnginePool) RegisterFunction(name string, fn any) error + func (p *AutoGrowEnginePool) RegisterGlobal(name string, value any) error + func (p *AutoGrowEnginePool) RegisterModule(name string, module any) error + func (p *AutoGrowEnginePool) Release(e Engine) + func (p *AutoGrowEnginePool) SetSource(source source.Reader) + func (p *AutoGrowEnginePool) StartWatch(ctx context.Context, key string) error + func (p *AutoGrowEnginePool) StopWatch(key string) error + type Engine interface + func NewScriptEngine(typ Type) (Engine, error) + type EngineFactoryFunc func(ctx context.Context) (Engine, error) + type EnginePool struct + func NewEnginePool(size int, typ Type) (*EnginePool, error) + func (p *EnginePool) Acquire() (Engine, error) + func (p *EnginePool) CallFunction(ctx context.Context, name string, args ...any) (any, error) + func (p *EnginePool) ClearError() + func (p *EnginePool) Close() error + func (p *EnginePool) Execute(ctx context.Context) (any, error) + func (p *EnginePool) ExecuteFromKey(ctx context.Context, key string) (any, error) + func (p *EnginePool) ExecuteFromKeys(ctx context.Context, keys []string) ([]any, error) + func (p *EnginePool) ExecuteString(ctx context.Context, name string, code string) (any, error) + func (p *EnginePool) GetGlobal(name string) (any, error) + func (p *EnginePool) GetLastError() error + func (p *EnginePool) GetSource() source.Reader + func (p *EnginePool) InitAll(ctx context.Context) error + func (p *EnginePool) IsClosed() bool + func (p *EnginePool) Load(ctx context.Context, key string) error + func (p *EnginePool) LoadMulti(ctx context.Context, keys []string) error + func (p *EnginePool) LoadString(ctx context.Context, name string, code string) error + func (p *EnginePool) RegisterFunction(name string, fn any) error + func (p *EnginePool) RegisterGlobal(name string, value any) error + func (p *EnginePool) RegisterModule(name string, module any) error + func (p *EnginePool) Release(e Engine) + func (p *EnginePool) SetSource(source source.Reader) + func (p *EnginePool) StartWatch(ctx context.Context, key string) error + func (p *EnginePool) StopWatch(key string) error + type FactoryFunc func() (Engine, error) + func GetFactory(typ Type) (FactoryFunc, bool) + type FunctionRegistrar interface + CallFunction func(ctx context.Context, name string, args ...any) (any, error) + RegisterFunction func(name string, fn any) error + func AsFunctionRegistrar(e any) FunctionRegistrar + type GlobalAccessor interface + GetGlobal func(name string) (any, error) + RegisterGlobal func(name string, value any) error + func AsGlobalAccessor(e any) GlobalAccessor + type Logger interface + Debug func(ctx context.Context, msg string, args ...any) + Error func(ctx context.Context, msg string, args ...any) + Info func(ctx context.Context, msg string, args ...any) + Warn func(ctx context.Context, msg string, args ...any) + With func(args ...any) Logger + func GetLogger() Logger + func NewSlogLogger() Logger + type Manager struct + func NewManager() *Manager + func (m *Manager) CloseAll() error + func (m *Manager) Get(name string) (Engine, bool) + func (m *Manager) GetDefault() (Engine, bool) + func (m *Manager) InitAll(ctx context.Context) error + func (m *Manager) Register(name string, eng Engine) error + func (m *Manager) Remove(name string, closeIfExists bool) + func (m *Manager) SetDefault(name string) + type ModuleRegistrar interface + RegisterModule func(name string, module any) error + func AsModuleRegistrar(e any) ModuleRegistrar + type Quota struct + MaxInstructions int + Timeout time.Duration + type QuotaController interface + SetQuota func(q Quota) + func AsQuotaController(e any) QuotaController + type RuntimeHook func(ctx context.Context) error + type RuntimeHookRegistrar interface + AddRuntimeHook func(hook RuntimeHook) error + func AsRuntimeHookRegistrar(e any) RuntimeHookRegistrar + type SandboxConfigurator interface + SetOpenLibs func(libs ...string) + func AsSandboxConfigurator(e any) SandboxConfigurator + type ScriptEngine interface + ClearError func() + Close func() error + GetLastError func() error + GetType func() Type + Init func(ctx context.Context) error + IsInitialized func() bool + type ScriptExecutor interface + Execute func(ctx context.Context) (any, error) + ExecuteFromKey func(ctx context.Context, key string) (any, error) + ExecuteFromKeys func(ctx context.Context, keys []string) ([]any, error) + ExecuteString func(ctx context.Context, name string, code string) (any, error) + func AsExecutor(e any) ScriptExecutor + type ScriptLoader interface + GetSource func() source.Reader + Load func(ctx context.Context, key string) error + LoadMulti func(ctx context.Context, keys []string) error + LoadString func(ctx context.Context, name string, code string) error + SetSource func(source source.Reader) + func AsLoader(e any) ScriptLoader + type ScriptWatcher interface + StartWatch func(ctx context.Context, key string) error + StopWatch func(key string) error + func AsWatcher(e any) ScriptWatcher + type SlogLogger struct + L *slog.Logger + func (s SlogLogger) Debug(ctx context.Context, msg string, args ...any) + func (s SlogLogger) Error(ctx context.Context, msg string, args ...any) + func (s SlogLogger) Info(ctx context.Context, msg string, args ...any) + func (s SlogLogger) Warn(ctx context.Context, msg string, args ...any) + func (s SlogLogger) With(args ...any) Logger + type SyncExecutor interface + ExecuteSync func(ctx context.Context) (any, error) + func AsSyncExecutor(e any) SyncExecutor + type Type string + const CELType + const ExprType + const GPythonType + const JavaScriptType + const LuaType + const StarlarkType + const TclType + const UnknownType + const WazeroType + const YaegiType + func ListFactories() []Type