Files
aqi/ws/context.go
2025-04-01 18:11:27 +08:00

39 lines
500 B
Go

package ws
import (
"math"
)
type Context struct {
Id string
Action string
Params string
Client *Client
Response *Action
Server *Server
index int8
handlers HandlersChain
logs []string
language string
defaultLng string
}
const abortIndex int8 = math.MaxInt8 / 2
func (c *Context) Next() {
c.index++
for c.index < int8(len(c.handlers)) {
c.handlers[c.index](c)
c.index++
}
}
// Abort 放弃调用后续方法
func (c *Context) Abort() {
c.index = abortIndex
}