plugin.go 902 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
package entity

import (
	goku_plugin "github.com/eolinker/goku-plugin"
)

const (
	PluginTypeGateway  = 0
	PluginTypeStrategy = 1
	PluginTypeApi      = 2
)

type PluginInfo struct {
	Name      string
	Priority  int
	Config    string
	IsStop    bool
	Type      int
	UpdateTag string
}
type MapString map[string]string

type PluginFactoryHandler struct {
	Info    *PluginInfo
	Factory goku_plugin.PluginFactory

	//Config    string
	//UpdateTag string
}

type PluginHandlerExce struct {
	PluginObj *goku_plugin.PluginObj
	Name      string
	Priority  int
	IsStop    bool
}

type PluginSlice []*PluginHandlerExce

func (p PluginSlice) Len() int { // 重写 Len() 方法
	return len(p)
}
func (p PluginSlice) Swap(i, j int) { // 重写 Swap() 方法
	p[i], p[j] = p[j], p[i]
}
func (p PluginSlice) Less(i, j int) bool { // 重写 Less() 方法, 从小到大排序
	return p[i].Priority < p[j].Priority
}