plugin

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS = iota
	STATUS_REGISTERED
	STATUS_INITIALIZED
	STATUS_STARTED
	STATUS_TERMINATED
)

Variables

View Source
var CallbackPoints = make(map[string]CallbackPoint)
View Source
var EntryPoints = make(map[string]EntryPoint)

Functions

func Callback

func Callback(namespace, code string, args ...interface{})

call from internal

func Init

func Init()

func RegisterCallbackPoint

func RegisterCallbackPoint(callback *CallbackPoint)

func RegisterEntryPoint

func RegisterEntryPoint(entryPoint *EntryPoint)

func RegisterPlugin

func RegisterPlugin(plugin *Plugin)

func Start

func Start()

func Terminate

func Terminate()

Types

type CallbackPoint

type CallbackPoint struct {
	NameSpace string
	Code      string
	Callbacks []func(args ...interface{})
}

type Engine

type Engine struct {
}

func (*Engine) CallEntryPoint

func (*Engine) CallEntryPoint(namespace, code string, args interface{})

Call from plugin

func (*Engine) InitPlugin

func (e *Engine) InitPlugin(plugin *Plugin) error

func (*Engine) RegisterCallback

func (*Engine) RegisterCallback(namespace, code string, f func(args ...interface{}))

func (*Engine) StartPlugin

func (*Engine) StartPlugin(plugin *Plugin) error

type EntryPoint

type EntryPoint struct {
	NameSpace string
	Code      string
	Entry     func(args ...interface{})
}

type IPlugin

type IPlugin interface {
	// Register 注册路由
	Register(group *gin.RouterGroup)

	// RouterPath 用户返回注册路由
	RouterPath() string
}

Plugin 插件接口

type Plugin

type Plugin struct {
	IPlugin
	Name        string
	Description string
	UUID        string // universal identify, used by Plugin Market
	Priority    int
	Status      int
	Enabled     bool
}

func (*Plugin) Init

func (*Plugin) Init()

func (*Plugin) Register

func (*Plugin) Register()

func (*Plugin) Start

func (*Plugin) Start()

func (*Plugin) Terminate

func (*Plugin) Terminate()

Jump to

Keyboard shortcuts

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