1 Star 1 Fork 0

titan-kit / titan

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
middleware.go 475 Bytes
一键复制 编辑 原始数据 按行查看 历史
蝶衣人生 提交于 2021-05-29 14:04 . first commit
package middleware
import "context"
// Handler 定义由中间件调用的处理程序.
type Handler func(ctx context.Context, req interface{}) (interface{}, error)
// Middleware 是MVC/gRPC传输中间件.
type Middleware func(Handler) Handler
// Chain 返回指定服务节点的链式处理程序的中间件.
func Chain(m ...Middleware) Middleware {
return func(next Handler) Handler {
for i := len(m) - 1; i >= 0; i-- {
next = m[i](next)
}
return next
}
}
1
https://gitee.com/titan-kit/titan.git
git@gitee.com:titan-kit/titan.git
titan-kit
titan
titan
v0.0.4

搜索帮助