1 Star 0 Fork 0

nqlite / ngossip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
middleware.go 501 Bytes
一键复制 编辑 原始数据 按行查看 历史
jiaweicheng 提交于 2024-02-16 13:42 . update *
package middleware
import (
"context"
)
// Handler defines the handler invoked by Middleware.
type Handler func(ctx context.Context, req interface{}) (interface{}, error)
// Middleware is HTTP/gRPC transport middleware.
type Middleware func(Handler) Handler
// Chain returns a Middleware that specifies the chained handler for endpoint.
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/nqlite/ngossip.git
git@gitee.com:nqlite/ngossip.git
nqlite
ngossip
ngossip
e110283f372f

搜索帮助