feat:插件注册&差分so

This commit is contained in:
songzhibin97
2021-08-21 10:48:44 +08:00
parent 513003a8bb
commit 181b3a985e
4 changed files with 44 additions and 27 deletions

View File

@@ -1,9 +1,6 @@
package plugin
import (
"plugin"
"sync"
"github.com/gin-gonic/gin"
)
@@ -11,26 +8,6 @@ const (
OnlyFuncName = "Plugin"
)
var ManagementPlugin = managementPlugin{mp: make(map[string]*plugin.Plugin)}
type managementPlugin struct {
mp map[string]*plugin.Plugin
sync.Mutex
}
func (m *managementPlugin) SetPlugin(key string, p *plugin.Plugin) {
m.Lock()
defer m.Unlock()
m.mp[key] = p
}
func (m *managementPlugin) GetPlugin(key string) (p *plugin.Plugin, ok bool) {
m.Lock()
defer m.Unlock()
p, ok = m.mp[key]
return
}
// Plugin 插件模式接口化
type Plugin interface {
// Register 注册路由