scripts

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	IsRun atomic.Bool
	// contains filtered or unexported fields
}

Engine ...

func NewEngine added in v0.0.26

func NewEngine(s *m.Script, functions, structures *Pull) (engine *Engine, err error)

NewEngine ...

func (*Engine) AssertFunction added in v0.0.26

func (s *Engine) AssertFunction(f string, arg ...interface{}) (result string, err error)

AssertFunction ...

func (*Engine) Compile

func (s *Engine) Compile() (err error)

Compile ...

func (*Engine) Do

func (s *Engine) Do() (string, error)

Do ...

func (*Engine) DoFull

func (s *Engine) DoFull() (res string, err error)

DoFull ...

func (*Engine) EvalScript added in v0.0.26

func (s *Engine) EvalScript(script *m.Script) (result string, err error)

EvalScript ...

func (*Engine) EvalString

func (s *Engine) EvalString(str ...string) (result string, errs error)

EvalString ...

func (*Engine) File

func (s *Engine) File(path string) ([]byte, error)

File ...

func (*Engine) Get

func (s *Engine) Get() IScript

Get ...

func (*Engine) Print

func (s *Engine) Print(v ...interface{})

Print ...

func (*Engine) PushFunction

func (s *Engine) PushFunction(name string, i interface{})

PushFunction ...

func (*Engine) PushStruct

func (s *Engine) PushStruct(name string, i interface{})

PushStruct ...

func (*Engine) ScriptId added in v0.12.0

func (s *Engine) ScriptId() int64

type EngineWatcher added in v0.12.0

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

func NewEngineWatcher added in v0.15.0

func NewEngineWatcher(script *m.Script, s *scriptService, eventBus bus.Bus) *EngineWatcher

func (*EngineWatcher) BeforeSpawn added in v0.15.0

func (w *EngineWatcher) BeforeSpawn(f func(engine *Engine))

func (*EngineWatcher) Engine added in v0.12.0

func (w *EngineWatcher) Engine() *Engine

func (*EngineWatcher) PopFunction added in v0.16.1

func (w *EngineWatcher) PopFunction(name string)

func (*EngineWatcher) PopStruct added in v0.16.1

func (w *EngineWatcher) PopStruct(name string)

func (*EngineWatcher) PushFunction added in v0.16.1

func (w *EngineWatcher) PushFunction(name string, f interface{})

func (*EngineWatcher) PushStruct added in v0.16.1

func (w *EngineWatcher) PushStruct(name string, str interface{})

func (*EngineWatcher) Spawn added in v0.12.0

func (w *EngineWatcher) Spawn(f func(engine *Engine))

func (*EngineWatcher) Stop added in v0.12.0

func (w *EngineWatcher) Stop()

type EnginesWatcher added in v0.15.0

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

func NewEnginesWatcher added in v0.15.0

func NewEnginesWatcher(scripts []*m.Script, s *scriptService, eventBus bus.Bus) *EnginesWatcher

func (*EnginesWatcher) AssertFunction added in v0.15.0

func (w *EnginesWatcher) AssertFunction(f string, arg ...interface{}) (result string, err error)

func (*EnginesWatcher) BeforeSpawn added in v0.15.0

func (w *EnginesWatcher) BeforeSpawn(f func(engine *Engine))

func (*EnginesWatcher) Engine added in v0.15.0

func (w *EnginesWatcher) Engine() *Engine

func (*EnginesWatcher) PopFunction added in v0.16.1

func (w *EnginesWatcher) PopFunction(name string)

func (*EnginesWatcher) PopStruct added in v0.16.1

func (w *EnginesWatcher) PopStruct(name string)

func (*EnginesWatcher) PushFunction added in v0.16.1

func (w *EnginesWatcher) PushFunction(name string, f interface{})

func (*EnginesWatcher) PushStruct added in v0.16.1

func (w *EnginesWatcher) PushStruct(name string, str interface{})

func (*EnginesWatcher) Spawn added in v0.15.0

func (w *EnginesWatcher) Spawn(f func(engine *Engine))

func (*EnginesWatcher) Stop added in v0.15.0

func (w *EnginesWatcher) Stop()

type IScript added in v0.0.26

type IScript interface {
	Init() error
	Do() (string, error)
	AssertFunction(string, ...interface{}) (string, error)
	Compile() error
	PushStruct(string, interface{})
	PushFunction(string, interface{})
	EvalString(string) (string, error)
	CreateProgram(name, source string) (err error)
	RunProgram(name string) (result string, err error)
}

IScript ...

type Javascript

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

Javascript ...

func NewJavascript added in v0.0.26

func NewJavascript(engine *Engine) *Javascript

NewJavascript ...

func (*Javascript) AssertFunction added in v0.0.26

func (j *Javascript) AssertFunction(f string, args ...interface{}) (result string, err error)

AssertFunction ...

func (*Javascript) Compile

func (j *Javascript) Compile() (err error)

Compile ...

func (*Javascript) CreateProgram added in v0.0.26

func (j *Javascript) CreateProgram(name, source string) (err error)

CreateProgram ...

func (*Javascript) Do

func (j *Javascript) Do() (result string, err error)

Do ...

func (*Javascript) EvalString

func (j *Javascript) EvalString(src string) (result string, err error)

EvalString ...

func (*Javascript) GetCompiler

func (j *Javascript) GetCompiler() error

GetCompiler ...

func (*Javascript) Init

func (j *Javascript) Init() (err error)

Init ...

func (*Javascript) PushFunction

func (j *Javascript) PushFunction(name string, s interface{})

PushFunction ...

func (*Javascript) PushStruct

func (j *Javascript) PushStruct(name string, s interface{})

PushStruct ...

func (*Javascript) RunProgram added in v0.0.26

func (j *Javascript) RunProgram(name string) (result string, err error)

RunProgram ...

type Pull

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

Pull ...

func NewPull added in v0.0.26

func NewPull() *Pull

NewPull ...

func (*Pull) Get added in v0.0.26

func (p *Pull) Get(name string) (value interface{}, ok bool)

Get ...

func (*Pull) Pop added in v0.12.0

func (p *Pull) Pop(name string)

Pop ...

func (*Pull) Purge added in v0.5.0

func (p *Pull) Purge()

Purge ...

func (*Pull) Push added in v0.12.0

func (p *Pull) Push(name string, s interface{})

Push ...

func (*Pull) Range added in v0.12.0

func (p *Pull) Range(f func(key, value interface{}) bool)

type ScriptService

type ScriptService interface {
	NewEngine(s *m.Script) (*Engine, error)
	NewEngineWatcher(*m.Script) (*EngineWatcher, error)
	NewEnginesWatcher([]*m.Script) (*EnginesWatcher, error)
	PushStruct(name string, s interface{})
	PopStruct(name string)
	PushFunctions(name string, s interface{})
	PopFunction(name string)
	Restart()
}

ScriptService ...

func NewScriptService

func NewScriptService(lc fx.Lifecycle,
	cfg *m.AppConfig,
	storage *storage.Storage,
	eventBus bus.Bus) ScriptService

NewScriptService ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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