v5sdkgo/ws/ws_middleware.go
2024-12-14 19:09:06 +08:00

20 lines
357 B
Go

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
}