package
Version:
v0.0.0-...-9d33de4
Opens a new window with list of versions in this module.
Published: Mar 28, 2020
License: Apache-2.0
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func BindAndValid(c *gin.Context, form interface{}) (httpCode, errCode int)
BindAndValid binds and validates data
MarkErrors logs error logs
func Valid(form interface{}) (int, int)
使用 validates 数据校验
type Auth struct {
UserId int `json:"user_id"`
Username string `json:"username"`
}
认证信息
Gin业务响应
func (g *Gin) Fail(data interface{})
返回失败gin.JSON
func (g *Gin) Response(httpCode, errCode int, data interface{})
返回gin.JSON
func (g *Gin) Success(data interface{})
返回成功gin.JSON
type Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.