Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OK request is successful. OK = &Response{ Code: http.StatusOK, Message: "ok", Data: nil, } // Err request is failed. Err = &Response{ Code: http.StatusInternalServerError, Message: "unknown error", Data: nil, } )
Functions ¶
func AddErrorHandlingMiddleware ¶
func AddErrorHandlingMiddleware() gin.HandlerFunc
AddErrorHandlingMiddleware is used to add error handling middleware.
Types ¶
type Response ¶
type Response struct { Code int `json:"code,omitempty"` Message string `json:"msg,omitempty"` Data interface{} `json:"data,omitempty"` }
Response defines the response struct.
func (*Response) WithMessage ¶
WithMessage set response message.
Click to show internal directories.
Click to hide internal directories.