Ai
1 Star 1 Fork 0

dreamwood/EZ框架核心

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server.go 937 Bytes
一键复制 编辑 原始数据 按行查看 历史
dreamwood 提交于 2022-12-11 14:04 +08:00 . init
package server
import (
"net/http"
)
type ServerHandler struct {
http.Handler
}
func (this *ServerHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
operation:=NewOperation(resp,req)
defer operation.Timer.Done()
//添加一些公共的前置操作
tPrepare := operation.Timer.Add("GlobalPreparer")
for name, action := range routeHub.Preparer {
tPrepareItem := operation.Timer.Add(name)
(*action)(operation)
tPrepareItem.Done()
if operation.IsStop {
return
}
}
tPrepare.Done()
//业务逻辑处理流程
Dispatch(operation)
//添加一些公共的后续操作
tFinisher := operation.Timer.Add("GlobalFinisher")
for name, action := range routeHub.Finisher {
tFinisherItem := operation.Timer.Add(name)
(*action)(operation)
tFinisherItem.Done()
if operation.IsStop {
return
}
}
tFinisher.Done()
}
func NewServerHandler() *ServerHandler {
hd := new(ServerHandler)
return hd
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dreamwood/ez.git
git@gitee.com:dreamwood/ez.git
dreamwood
ez
EZ框架核心
v1.0.2

搜索帮助