Documentation
¶
Index ¶
- func AdaptOK(c *gin.Context, data interface{}, msg string)
- func Custom(c *gin.Context, h gin.H)
- func Error(c *gin.Context, code ErrCode, data interface{})
- func ErrorParams(c *gin.Context, err error)
- func Errorf(c *gin.Context, code ErrCode, format string, values ...interface{})
- func InternalServerError(c *gin.Context)
- func OK(c *gin.Context, data interface{})
- func PageOK(c *gin.Context, result interface{}, count int, pageIndex int, pageSize int, ...)
- type ErrCode
- type ErrResponse
- type Page
- type PageResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorParams ¶
func InternalServerError ¶
Types ¶
type ErrCode ¶
type ErrCode int
var ( // 客户端发送的数据包含非法参数 Err_Invalid_Argument ErrCode = 400 // token缺失或过期,请求未能通过身份认证 Err_Unauthenticated ErrCode = 401 // 客户端没有足够的权限 Err_Permission_Denied ErrCode = 403 // 资源未找到 Err_Not_found ErrCode = 404 // 并发冲突 Err_Aborted ErrCode = 409 // 资源配额不足或达不到速率限制 Err_Resource_Exhausted ErrCode = 429 // 请求被客户端取消 Err_Cancelled ErrCode = 499 // 内部服务器错误 Err_Internal ErrCode = 500 // API方法没有被服务器实现 Err_Not_Implemented ErrCode = 501 Err_Unavailable ErrCode = 503 // 请求超过了截止日期 Err_Dealine_Exceed ErrCode = 504 )
type ErrResponse ¶
type PageResponse ¶
type PageResponse struct {
// 代码
Code int `json:"code" example:"200"`
// 数据集
Data Page `json:"data"`
// 消息
Msg string `json:"msg"`
}
func (*PageResponse) ReturnOK ¶
func (res *PageResponse) ReturnOK() *PageResponse
Click to show internal directories.
Click to hide internal directories.