define

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ELogLevelDebug = 1
	ELogLevelInfo  = 2
	ELogLevelWarn  = 4
	ELogLevelError = 8
	ELogLevelFatal = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiHandler

type ApiHandler func(map[string]interface{}) (interface{}, error) // API函数指针

注册相关函数定义

type ELogLevel

type ELogLevel int

func (ELogLevel) ToString

func (level ELogLevel) ToString() string

type NoticeHandler

type NoticeHandler func(interface{}) // 消息函数指针

注册相关函数定义

type QBasePlugin

type QBasePlugin struct {
	QPlugin
	// contains filtered or unexported fields
}

func (*QBasePlugin) Init

func (plugin *QBasePlugin) Init() error

func (*QBasePlugin) Invoke

func (plugin *QBasePlugin) Invoke(route string, args map[string]interface{}) (interface{}, error)

func (*QBasePlugin) Logger

func (plugin *QBasePlugin) Logger() QLogger

func (*QBasePlugin) RegBus

func (plugin *QBasePlugin) RegBus(bus QBus)

func (*QBasePlugin) SendNotice

func (plugin *QBasePlugin) SendNotice(topic string, isSync bool, arg interface{}) error

func (*QBasePlugin) Stop

func (plugin *QBasePlugin) Stop() error

type QBus

type QBus interface {
	//Plug 接入插件
	Plug(QPlugin) []error
	Invoke(route string, args map[string]interface{}) (interface{}, error)
	SendNotice(topic string, isSync bool, arg interface{}) error
	Logger() QLogger
}

QBus @Description: 总线接口

type QLogger

type QLogger interface {
	Debug(format string, params ...interface{})
	Info(format string, params ...interface{})
	Warn(format string, params ...interface{})
	Error(format string, params ...interface{})
	Fatal(format string, params ...interface{})
}

type QPlugin

type QPlugin interface {

	//RegBus 注册总线
	RegBus(QBus)
	//Apis 向总线提供API声明
	Apis() map[string]ApiHandler
	//Subscribes 向总线提供消息订阅声明
	Subscribes() map[string]NoticeHandler
	Init() error
	Stop() error
	//GetId 向总线提供业务唯一编号 自动化测试和log需求
	GetId() string
	//Invoke 调用总线上的业务方法
	Invoke(route string, args map[string]interface{}) (interface{}, error)
	//SendNotice 向总线上的业务方法
	SendNotice(topic string, isSync bool, arg interface{}) error
	Logger() QLogger
}

QPlugin @Description: 插件接口

Jump to

Keyboard shortcuts

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