Documentation ¶
Index ¶
- Constants
- func ErrorHandler() gin.HandlerFunc
- type ApiError
- func BadRequest(reason string) *ApiError
- func FailedDependency(reason string) *ApiError
- func Forbidden(reason string) *ApiError
- func InternalServerError(reason string) *ApiError
- func Normalize(err error) *ApiError
- func NotFound(reason string) *ApiError
- func NotImplemented(reason string) *ApiError
- func Unauthorized(reason string) *ApiError
- func UnprocessableEntity(reason string) *ApiError
- type GinEngine
- func (e *GinEngine) AddRoute(group *gin.RouterGroup, path string, method int, handlers ...gin.HandlerFunc)
- func (e *GinEngine) NewGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func (e *GinEngine) ServerHttp(recorder *httptest.ResponseRecorder, request *http.Request)
- func (e *GinEngine) StartServer(ctx context.Context, tracing bool)
- func (e *GinEngine) Use(middleware ...gin.HandlerFunc)
Constants ¶
View Source
const ( GET = iota POST PUT PATCH DELETE )
Exporting constants to avoid hardcoding these all over, and ending up with a uppercase "POST" bug in the future.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler() gin.HandlerFunc
Types ¶
type ApiError ¶
Server response status code and associated error message
func BadRequest ¶ added in v0.3.0
func FailedDependency ¶ added in v0.3.0
func InternalServerError ¶ added in v0.3.0
func NotImplemented ¶ added in v0.3.0
func Unauthorized ¶ added in v0.3.0
func UnprocessableEntity ¶ added in v0.3.0
type GinEngine ¶
type GinEngine struct {
// contains filtered or unexported fields
}
func NewGinEngine ¶
func NewGinEngine() *GinEngine
func (*GinEngine) AddRoute ¶
func (e *GinEngine) AddRoute(group *gin.RouterGroup, path string, method int, handlers ...gin.HandlerFunc)
AddRoute Add a new endpoint mapping
func (*GinEngine) NewGroup ¶
func (e *GinEngine) NewGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
func (*GinEngine) ServerHttp ¶
func (e *GinEngine) ServerHttp(recorder *httptest.ResponseRecorder, request *http.Request)
Used for unit testing
func (*GinEngine) Use ¶ added in v0.2.7
func (e *GinEngine) Use(middleware ...gin.HandlerFunc)
Adds middleware
Click to show internal directories.
Click to hide internal directories.