mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 13:18:01 +08:00
25 lines
604 B
Go
25 lines
604 B
Go
// Copyright 2019 gf Author(https://github.com/gogf/gf). 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
|
|
|
|
import "github.com/gogf/gf/os/glog"
|
|
|
|
// Plugin is the interface for server plugin.
|
|
type Plugin interface {
|
|
Install(s *Server) error
|
|
Remove() error
|
|
}
|
|
|
|
// Plugin adds plugin for server.
|
|
func (s *Server) Plugin(plugin ...Plugin) {
|
|
for _, p := range plugin {
|
|
if err := p.Install(s); err != nil {
|
|
glog.Fatal(err)
|
|
}
|
|
}
|
|
}
|