Documentation
¶
Index ¶
- Constants
- func AssertErrorType(err interface{}) (code uint, reason, message string)
- func Error(ctx *gin.Context, e boterrors.APIError)
- func ErrorRender(ctx *gin.Context, statusCode int, e error, errMsg string)
- func OK(ctx *gin.Context, data any, total int)
- type Data
- type Resp
- type Response
- type StatusType
Constants ¶
View Source
const ( KubernetesErrCode = -1 BotErrCode = -2 Success StatusType = "success" Failure StatusType = "failure" )
View Source
const RespMsg = "message"
Variables ¶
This section is empty.
Functions ¶
func AssertErrorType ¶
AssertErrorType is used to get actually type fo error, and get the status code and messages.
func ErrorRender ¶
ErrorRender when statusCode is -1, it means e for k8s error, ErrorRender will extract error code automatically .
Types ¶
type Response ¶
type Response struct { Code int `json:"code"` Status StatusType `json:"status"` Error boterrors.APIError `json:"error"` Data interface{} `json:"data"` }
type StatusType ¶
type StatusType string
Click to show internal directories.
Click to hide internal directories.