mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 11:18:02 +08:00
23 lines
935 B
Go
23 lines
935 B
Go
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package ghttp
|
|
|
|
// Plugin is the interface for server plugin.
|
|
type Plugin interface {
|
|
Name() string // Name returns the name of the plugin.
|
|
Author() string // Author returns the author of the plugin.
|
|
Version() string // Version returns the version of the plugin, like "v1.0.0".
|
|
Description() string // Description returns the description of the plugin.
|
|
Install(s *Server) error // Install installs the plugin BEFORE the server starts.
|
|
Remove() error // Remove removes the plugin when server shuts down.
|
|
}
|
|
|
|
// Plugin adds plugin to the server.
|
|
func (s *Server) Plugin(plugin ...Plugin) {
|
|
s.plugins = append(s.plugins, plugin...)
|
|
}
|