Documentation
¶
Index ¶
- Constants
- func Fail(c *gin.Context)
- func FailWithError(c *gin.Context, err error)
- func Ok(c *gin.Context)
- func OkWithData(c *gin.Context, data interface{})
- func ValidateBind(c *gin.Context, param interface{}) bool
- func ValidateIntQuery(c *gin.Context, query string, result *int) bool
- func ValidateQuery(c *gin.Context, query string) bool
- type BusinessError
- type HTTPError
- type Meta
- type Response
Constants ¶
View Source
const ( // code= 100x... 用户模块的错误 ERROR_USERNAME_USED = 1001 ERROR_PASSWORD_WRONG = 1002 ERROR_ABNORMAL_PERMISSIONS = 1003 // code= 200x... token 相关错误 ERROR_TOKEN_NOT_EXIST = 2001 ERROR_TOKEN_WRONG = 2002 ERROR_TOKEN_EXPIRE = 2003 // code= 300x... 参数验证错误 ERROR_PARAMETER_VALIDATION = 3001 ERROR_QUERY_NOT_EXIST = 3002 )
View Source
const ( ERROR = 500 SUCCESS = 200 )
Variables ¶
This section is empty.
Functions ¶
func OkWithData ¶
func ValidateBind ¶ added in v1.0.4
bind请求体并进行参数验证
func ValidateIntQuery ¶ added in v1.0.6
query 参数验证
Types ¶
type BusinessError ¶
type BusinessError struct {
Code int
}
func (BusinessError) Error ¶
func (e BusinessError) Error() string
type HTTPError ¶
type HTTPError struct { Code int `json:"code" example:"500"` Msg string `json:"msg" example:"操作失败"` }
HTTPError example
Click to show internal directories.
Click to hide internal directories.