plugin

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const HUB = "https://hub.iot-master.com"

Variables

This section is empty.

Functions

func Boot

func Boot() error

func Close

func Close()

func Download

func Download(id string, version string) error

func From

func From(id string, manifest *Manifest) error

func Load

func Load(id string) error

func Open added in v4.1.0

func Open() error

func ProxyApp

func ProxyApp(ctx *gin.Context)

func Register

func Register(app *Manifest)

func Store

func Store(id string, m *Manifest) error

Types

type License

type License struct {
	AppId    string         `json:"app_id"`
	Issuer   string         `json:"issuer,omitempty"`
	User     string         `json:"user,omitempty"`
	Machine  string         `json:"machine"`
	Version  semver.Version `json:"version,omitempty"` //版本
	ExpireAt types.Time     `json:"expire_at"`
	Content  string         `json:"content"`
}

type Manifest

type Manifest struct {
	Id          string `json:"id"`                    //ID
	Version     string `json:"version,omitempty"`     //版本 semver.Version
	Icon        string `json:"icon,omitempty"`        //图标
	Name        string `json:"name,omitempty"`        //名称
	Description string `json:"description,omitempty"` //说明

	//菜单入口
	Menus map[string]*Menu `json:"menus,omitempty"` //admin, project

	//外部插件 进程
	//Process *Process `json:"process,omitempty"`
	Entry string `json:"entry,omitempty"`
	Delay int    `json:"delay,omitempty"` //延迟启动 s

	//启动接口
	Startup  func() error `json:"-"`
	Shutdown func() error `json:"-"`

	//更多
	Dependencies map[string]string `json:"dependencies,omitempty"` //依赖的插件,应用->版本
}

func GetPlugins

func GetPlugins() []*Manifest
type Menu struct {
	Name  string      `json:"name"`
	Items []*MenuItem `json:"items"`
}
type MenuItem struct {
	Name       string `json:"name,omitempty"`
	Url        string `json:"url,omitempty"`
	Standalone bool   `json:"standalone,omitempty"` //独立页面,弹窗显示
}

type Page added in v4.0.10

type Page struct {
	Target string         `json:"target"`
	Select map[string]any `json:"select,omitempty"` //页面选择器,比如:modbus, s7 ...
	Name   string         `json:"name"`
	Url    string         `json:"url"`
}

type Plugin

type Plugin struct {
	*Manifest

	Addr    string
	Running bool
	// contains filtered or unexported fields
}

func Ensure

func Ensure(id string) (*Plugin, error)

func Get

func Get(id string) *Plugin

func New

func New(manifest *Manifest) *Plugin

func (*Plugin) Close

func (p *Plugin) Close() error

func (*Plugin) Start

func (p *Plugin) Start() error

type Process

type Process struct {
	Main  string `json:"main"`
	Delay int    `json:"delay,omitempty"` //延迟启动 s
}

type Runner

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

func (*Runner) Start

func (r *Runner) Start() error

Jump to

Keyboard shortcuts

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