Documentation ¶
Index ¶
- Variables
- type Context
- func (c *Context) AddRetError(err error)
- func (c *Context) CheckField(regs []*valid.Regulation) (map[string]any, error)
- func (c *Context) ParamDataArrayInt(reg *valid.Regulation) (bool, []int64, error)
- func (c *Context) ParamDataArrayString(reg *valid.Regulation) (bool, []string, error)
- func (c *Context) ParamDataInt(reg *valid.Regulation) (bool, int64, error)
- func (c *Context) ParamDataString(reg *valid.Regulation) (bool, string, error)
- func (c *Context) WebSocket() (*websocket.Conn, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var CtxPool *sync.Pool
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { StartTime time.Time //记录请求开始处理时间 Ctx context.Context ResponseWriter http.ResponseWriter RetData any //返回数据 Request *http.Request GetPost url.Values //get参数与 form-data或者x-www-form-urlencoded合集 BodyData *[]byte //body内包含的数据 Valid *valid.Valid //参数校验 StructFuncName string //最终调用的structFuncName 如果为方法则为自定义名称 如果为struct则为struct/method ClientIp string //客户端IP RetError string //错误信息 RequestId int64 //请求ID RetCode int //返回码 CustomRet bool //自定义处理返回信息 跳过统一返回处理 }
Context 处理请求上下文
func NewContext ¶
func (*Context) CheckField ¶
func (*Context) ParamDataArrayInt ¶
func (*Context) ParamDataArrayString ¶
func (*Context) ParamDataInt ¶
ParamDataInt 检查参数并返回数字
func (*Context) ParamDataString ¶
ParamDataString 检查参数并返回字符串值 name 参数名 desc 参数说明 require 是否必须有值 min 最小长度 max 最大长度 0=65535 def 默认值 return exist是否存在参数
Click to show internal directories.
Click to hide internal directories.