Help us shape the future of Go! Take the 2026 Go Developer Survey

widget

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Widgets = map[string]*Widget{}

Widgets the registered widgets

Functions

func DirNotExists

func DirNotExists(dir string) bool

DirNotExists validate the folder

func InstName

func InstName(root string, file string) string

InstName root: "/tests/apis" file: "/tests/apis/foo/bar.http.json"

func Walk

func Walk(root string, typeName string, cb func(root, filename string) error) error

Walk the path

Types

type Handler

type Handler func()

Handler the javascript process

type Instance

type Instance struct {
	Name string
	DSL  map[string]interface{}
}

Instance the widget instance

type ModuleRegister

type ModuleRegister map[string]func(name string, source []byte) error

ModuleRegister register model, flow, etc.

func (ModuleRegister) Call

func (r ModuleRegister) Call(method string, name string, source []byte) error

Call by name

type ProcessRegister

type ProcessRegister func(widget, name string, process func(args ...interface{}) interface{}) error

ProcessRegister register process

type Widget

type Widget struct {
	Name            string
	Path            string
	Label           string   `json:"label,omitempty"`
	Description     string   `json:"description,omitempty"`
	Version         string   `json:"version,omitempty"`
	Root            string   `json:"root,omitempty"`
	Extension       string   `json:"extension,omitempty"`
	Modules         []string `json:"modules,omitempty"`
	Handlers        map[string]Handler
	Instances       map[string]*Instance
	Runtime         *runtime.Runtime
	ModuleRegister  ModuleRegister
	ProcessRegister ProcessRegister
}

Widget the widget structs

func Load

func Load(path string, runtime *runtime.Runtime, processRegister ProcessRegister, moduleRegister ModuleRegister) (*Widget, error)

Load load a widget

func (*Widget) CompileCompile

func (w *Widget) CompileCompile(name string, dsl map[string]interface{}) (res map[string]interface{}, err error)

CompileCompile Execute the compile.js Compile function

func (*Widget) CompileExec

func (w *Widget) CompileExec(method string, args ...interface{}) (interface{}, error)

CompileExec Execute the compile script

func (*Widget) CompileOnLoad

func (w *Widget) CompileOnLoad(name string, dsl map[string]interface{}) (err error)

CompileOnLoad Execute the compile.js OnLoad function

func (*Widget) CompileSource

func (w *Widget) CompileSource() (res map[string][]byte, err error)

CompileSource Execute the compile.js Source function

func (*Widget) Exec

func (w *Widget) Exec(name, method string, args ...interface{}) (interface{}, error)

Exec Execute the export script

func (*Widget) Export

func (w *Widget) Export(method, name string, dsl map[string]interface{}) (res map[string][]byte, err error)

Export Execute the export.js Models function and return map[string][]byte

func (*Widget) ExportExec

func (w *Widget) ExportExec(method string, args ...interface{}) (interface{}, error)

ExportExec Execute the export script

func (*Widget) InstanceRoot

func (w *Widget) InstanceRoot() (string, error)

InstanceRoot get the instance root path

func (*Widget) Load

func (w *Widget) Load() error

Load load the widget instances

func (*Widget) LoadInstance

func (w *Widget) LoadInstance(source []byte, name string) error

LoadInstance load a instance

func (*Widget) LoadInstanceFile

func (w *Widget) LoadInstanceFile(file string, name string) error

LoadInstanceFile load a instance from a file

func (*Widget) Migrate

func (w *Widget) Migrate() error

Migrate the migrate

func (*Widget) ProcessExec

func (w *Widget) ProcessExec(method string, args ...interface{}) (interface{}, error)

ProcessExec Execute the process script

func (*Widget) RegisterAPI

func (w *Widget) RegisterAPI() (err error)

RegisterAPI Execute the export.js API function and register the Apis

func (*Widget) RegisterModule

func (w *Widget) RegisterModule(module, name string, dsl map[string]interface{}) (err error)

RegisterModule Execute the export.js name function and register the modules

func (*Widget) RegisterProcess

func (w *Widget) RegisterProcess() (err error)

RegisterProcess Execute the process.js Export function and register the process

func (*Widget) ReloadInstance

func (w *Widget) ReloadInstance(source []byte, name string) error

ReloadInstance reload the widget instance

func (*Widget) ReloadInstanceFile

func (w *Widget) ReloadInstanceFile(file string, name string) error

ReloadInstanceFile reload the widget instance from file

func (*Widget) RemoveInstance

func (w *Widget) RemoveInstance(name string)

RemoveInstance remove the widget instance

func (*Widget) ScriptExec

func (w *Widget) ScriptExec(script, method string, args ...interface{}) (interface{}, error)

ScriptExec Execute the other script

Jump to

Keyboard shortcuts

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