Documentation ¶
Index ¶
- Constants
- func BadRequest(ctx *gin.Context, condition bool, msg ...string) bool
- func Custom(ctx *gin.Context, bCode int, msg string)
- func Json(ctx *gin.Context, data interface{})
- func LoginExpired(ctx *gin.Context, condition bool, msg ...string) bool
- func NoLogin(ctx *gin.Context, condition bool, msg ...string) bool
- func NoPermission(ctx *gin.Context, condition bool, msg ...string) bool
- func Ok(ctx *gin.Context)
- func ParamInvalid(ctx *gin.Context, condition bool, msg ...string) bool
- func ParamValid(ctx *gin.Context, err error, obj interface{}) booldeprecated
- func ParamValidation(ctx *gin.Context, obj interface{}) bool
- func SeverError(ctx *gin.Context, condition bool, msg ...string) bool
- type PaginationResult
- type Resp
- type Result
Constants ¶
View Source
const ( BAD_REQUEST_CODE = -10400 NONE_LOGIN_CODE = -10401 LOGIN_TOKEN_EXPIRED = -10402 NO_PERMISSION_CODE = -10403 TOO_MANY_REQUEST_CODE = -10429 INTERNAL_SERVER_CODE = -10500 PARAM_FAILD_CODE = -10600 )
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest business-related error returned. Return true means the condition is true
func LoginExpired ¶
LoginExpired Login expired Return true means the condition is true
func NoPermission ¶
NoPermission Insufficient permission error. Return true means the condition is true
func ParamValid
deprecated
func ParamValidation ¶ added in v2.1.4
ParamValidation parameter validation, return false means that the validation failed
Types ¶
type PaginationResult ¶
type PaginationResult struct { Total int64 `json:"total"` // Total count PageSize int `json:"page_size"` // Page size PageIndex int `json:"page_index"` // Current page index Data any `json:"data"` // Response data }
PaginationResult Paging result
type Result ¶
type Result struct { Code int `json:"err_code"` // business code Message string `json:"err_msg"` // business message Data any `json:"ret,omitempty"` // Response data // contains filtered or unexported fields }
Result Return result
func (*Result) WithMessage ¶
Click to show internal directories.
Click to hide internal directories.