Documentation ¶
Index ¶
- Variables
- func AddRouter(f _configFunc)
- func CorsMiddleware() gin.HandlerFunc
- func ErrHandlerMiddleware(retError func(c *gin.Context, err *Error)) gin.HandlerFunc
- func HandleNotFound(c *gin.Context)
- func InstallRouters(e *gin.RouterGroup)
- func LogHandler(params *LogHandlerParams) gin.HandlerFunc
- type Error
- type HttpClient
- type HttpResponse
- type LogHandlerParams
- type PostParams
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Success = NewErrorWithStatusCode(http.StatusOK, http.StatusText(http.StatusOK)) ServerError = NewErrorWithStatusCode(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError)) NotFound = NewErrorWithStatusCode(http.StatusNotFound, http.StatusText(http.StatusNotFound)) )
Functions ¶
func ErrHandlerMiddleware ¶
func ErrHandlerMiddleware(retError func(c *gin.Context, err *Error)) gin.HandlerFunc
错误处理中间件
func LogHandler ¶
func LogHandler(params *LogHandlerParams) gin.HandlerFunc
Types ¶
type HttpClient ¶
* struct * Description: HttpClient
func (*HttpClient) Get ¶
func (c *HttpClient) Get(url string) *HttpResponse
func (*HttpClient) Post ¶
func (c *HttpClient) Post(postParams *PostParams) *HttpResponse
type HttpResponse ¶
type HttpResponse struct { StatusCode int BodyString string BodyBytes []byte Response *http.Response Err error }
* struct * Description: http操作返回对象
type LogHandlerParams ¶
Click to show internal directories.
Click to hide internal directories.