v5sdkgo/ws/ws_middleware.go

20 lines
357 B
Go
Raw Permalink Normal View History

2024-12-14 19:09:06 +08:00
package ws
import "fmt"
type ReqFunc func(...interface{}) (res bool, msg *Msg, err error)
type Decorator func(ReqFunc) ReqFunc
func handler(h ReqFunc, decors ...Decorator) ReqFunc {
for i := range decors {
d := decors[len(decors)-1-i]
h = d(h)
}
return h
}
func preprocess() (res bool, msg *Msg, err error) {
fmt.Println("preprocess")
return
}