Documentation ¶
Index ¶
- func CorsMiddleware() gin.HandlerFunc
- func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc
- type AppContext
- func (ac *AppContext) Cancel()
- func (ac *AppContext) Deadline() (deadline time.Time, ok bool)
- func (ac *AppContext) Done() <-chan struct{}
- func (ac *AppContext) Err() error
- func (ac *AppContext) FinishSuccess(res HTTPResponse) HTTPResponse
- func (ac *AppContext) RequestURI() string
- func (ac *AppContext) Value(key any) any
- type GinRouteBuilder
- type GinRoutesWrapper
- func (w *GinRoutesWrapper) Any(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) COUNT(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) DELETE(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) GET(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) Group(relativePath string) *GinRoutesWrapper
- func (w *GinRoutesWrapper) HEAD(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) OPTIONS(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) PATCH(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) POST(relativePath string) *GinRouteBuilder
- func (w *GinRoutesWrapper) PUT(relativePath string) *GinRouteBuilder
- type GinWrapper
- type HTTPResponse
- func APIError(g *gin.Context, errcode commonApiErr.APIErrorCode, msg string, e error) HTTPResponse
- func Data(sc int, contentType string, data []byte) HTTPResponse
- func Download(mimetype string, filepath string, filename string) HTTPResponse
- func File(mimetype string, filepath string) HTTPResponse
- func JSON(sc int, data any) HTTPResponse
- func NotImplemented(g *gin.Context) HTTPResponse
- func Redirect(sc int, newURL string) HTTPResponse
- func Status(sc int) HTTPResponse
- func Text(sc int, data string) HTTPResponse
- type PreContext
- type WHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func Wrap ¶
func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc
Types ¶
type AppContext ¶ added in v0.0.173
func CreateAppContext ¶ added in v0.0.173
func CreateAppContext(g *gin.Context, innerCtx context.Context, cancelFn context.CancelFunc) *AppContext
func (*AppContext) Cancel ¶ added in v0.0.173
func (ac *AppContext) Cancel()
func (*AppContext) Deadline ¶ added in v0.0.173
func (ac *AppContext) Deadline() (deadline time.Time, ok bool)
func (*AppContext) Done ¶ added in v0.0.173
func (ac *AppContext) Done() <-chan struct{}
func (*AppContext) Err ¶ added in v0.0.173
func (ac *AppContext) Err() error
func (*AppContext) FinishSuccess ¶ added in v0.0.173
func (ac *AppContext) FinishSuccess(res HTTPResponse) HTTPResponse
func (*AppContext) RequestURI ¶ added in v0.0.173
func (ac *AppContext) RequestURI() string
func (*AppContext) Value ¶ added in v0.0.173
func (ac *AppContext) Value(key any) any
type GinRouteBuilder ¶
type GinRouteBuilder struct {
// contains filtered or unexported fields
}
func (*GinRouteBuilder) Handle ¶
func (w *GinRouteBuilder) Handle(handler WHandlerFunc)
func (*GinRouteBuilder) Use ¶
func (w *GinRouteBuilder) Use(middleware ...gin.HandlerFunc) *GinRouteBuilder
type GinRoutesWrapper ¶
type GinRoutesWrapper struct {
// contains filtered or unexported fields
}
func (*GinRoutesWrapper) Any ¶ added in v0.0.177
func (w *GinRoutesWrapper) Any(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) COUNT ¶
func (w *GinRoutesWrapper) COUNT(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) DELETE ¶
func (w *GinRoutesWrapper) DELETE(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) GET ¶
func (w *GinRoutesWrapper) GET(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) Group ¶
func (w *GinRoutesWrapper) Group(relativePath string) *GinRoutesWrapper
func (*GinRoutesWrapper) HEAD ¶
func (w *GinRoutesWrapper) HEAD(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) OPTIONS ¶
func (w *GinRoutesWrapper) OPTIONS(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) PATCH ¶
func (w *GinRoutesWrapper) PATCH(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) POST ¶
func (w *GinRoutesWrapper) POST(relativePath string) *GinRouteBuilder
func (*GinRoutesWrapper) PUT ¶
func (w *GinRoutesWrapper) PUT(relativePath string) *GinRouteBuilder
type GinWrapper ¶
type GinWrapper struct { SuppressGinLogs bool // contains filtered or unexported fields }
func (*GinWrapper) NoRoute ¶ added in v0.0.177
func (w *GinWrapper) NoRoute(handler WHandlerFunc)
func (*GinWrapper) Routes ¶
func (w *GinWrapper) Routes() *GinRoutesWrapper
func (*GinWrapper) ServeHTTP ¶ added in v0.0.176
func (w *GinWrapper) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type HTTPResponse ¶
func APIError ¶
func APIError(g *gin.Context, errcode commonApiErr.APIErrorCode, msg string, e error) HTTPResponse
func File ¶
func File(mimetype string, filepath string) HTTPResponse
func JSON ¶
func JSON(sc int, data any) HTTPResponse
func NotImplemented ¶
func NotImplemented(g *gin.Context) HTTPResponse
func Redirect ¶ added in v0.0.174
func Redirect(sc int, newURL string) HTTPResponse
func Status ¶
func Status(sc int) HTTPResponse
func Text ¶
func Text(sc int, data string) HTTPResponse
type PreContext ¶ added in v0.0.173
type PreContext struct {
// contains filtered or unexported fields
}
func (*PreContext) Body ¶ added in v0.0.173
func (pctx *PreContext) Body(body any) *PreContext
func (*PreContext) Form ¶ added in v0.0.173
func (pctx *PreContext) Form(form any) *PreContext
func (*PreContext) Query ¶ added in v0.0.173
func (pctx *PreContext) Query(query any) *PreContext
func (PreContext) Start ¶ added in v0.0.173
func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse)
func (*PreContext) URI ¶ added in v0.0.173
func (pctx *PreContext) URI(uri any) *PreContext
type WHandlerFunc ¶
type WHandlerFunc func(PreContext) HTTPResponse
func RedirectFound ¶
func RedirectFound(newuri string) WHandlerFunc
func RedirectPermanent ¶
func RedirectPermanent(newuri string) WHandlerFunc
func RedirectTemporary ¶
func RedirectTemporary(newuri string) WHandlerFunc
Source Files ¶
Click to show internal directories.
Click to hide internal directories.