script

package
v0.0.0-...-967dab9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Halt = errors.New("Execution limit exceeded")
View Source
var UnknownScriptType = errors.New("Unknown script type")

Functions

This section is empty.

Types

type InitVMFunc

type InitVMFunc = func(m *ScriptManager)

type Script

type Script struct {
	ID      int
	Type    ScriptType
	Title   string
	Body    string
	Enabled bool
}

type ScriptManager

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

func NewScriptManager

func NewScriptManager(repo ScriptRepository, l log.FieldLogger, e event.EventManager, ircmanager *irc.ConnectionManager, config *config.Configuration, database *data.DB) *ScriptManager

func (*ScriptManager) AddOnInit

func (m *ScriptManager) AddOnInit(fn InitVMFunc)

func (*ScriptManager) Export

func (m *ScriptManager) Export() error

Export copies all scripts stored in the internal database to the filesystem.

func (*ScriptManager) GetVM

func (m *ScriptManager) GetVM(t ScriptType) (*jsVm, error)

func (*ScriptManager) Import

func (m *ScriptManager) Import() error

Import copies all scripts stored on the filesystem to the internal database.

func (*ScriptManager) ReInit

func (m *ScriptManager) ReInit()

func (*ScriptManager) Repl

func (m *ScriptManager) Repl()

func (*ScriptManager) RunUnsafe

func (m *ScriptManager) RunUnsafe(t ScriptType, code string) (result interface{}, err error)

type ScriptRepository

type ScriptRepository interface {
	FetchAll() []*Script
	Fetch(id int) *Script
	Save(script *Script)
	Delete(id int)
}

func NewScriptRepository

func NewScriptRepository(database *data.DB, conf *config.Configuration, logger log.FieldLogger) ScriptRepository

type ScriptType

type ScriptType string
const (
	Javascript ScriptType = "Javascript"
)

Jump to

Keyboard shortcuts

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