scripting

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Description string
	Code        ErrorCode
}

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode int
const (
	FileNotFound ErrorCode = iota
	CompilationError
	RuntimeError
)

type Service

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

func (*Service) AddModule

func (s *Service) AddModule(name string, module interface{})

AddModule adds internal module (may be loaded by require())

func (*Service) Prepare

func (s *Service) Prepare(eng *vivard.Engine, prov dep.Provider) (err error)

func (*Service) Process

func (s *Service) Process(ctx context.Context,
	operation string,
	context map[string]interface{},
	results []string) (map[string]interface{}, error)

Process looks for script to process given operation and runs it context objects will be put in the global scope of script return value contains the result of execution (with key "_") and variables's listed in results argument values

func (*Service) ProcessSingleRet

func (s *Service) ProcessSingleRet(ctx context.Context,
	operation string,
	context map[string]interface{}) (interface{}, error)

ProcessSingleRet looks for script to process given operation and runs it context objects will be put in the global scope of script return value is the result of execution

func (*Service) Provide

func (s *Service) Provide() interface{}

func (*Service) SetContext

func (s *Service) SetContext(ctx map[string]interface{})

SetContext sets context for all subsequantial calls

func (*Service) Start

func (s *Service) Start(eng *vivard.Engine, prov dep.Provider) error

Jump to

Keyboard shortcuts

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