Documentation ¶
Index ¶
- func BodyBuffer(g *gin.Context)
- func CorsMiddleware() gin.HandlerFunc
- func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc
- type AppContext
- 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
- func (w *GinRoutesWrapper) Use(middleware ...gin.HandlerFunc) *GinRoutesWrapper
- func (w *GinRoutesWrapper) WithJSONFilter(filter string) *GinRoutesWrapper
- type GinWrapper
- func (w *GinWrapper) DebugPrintRoutes()
- func (w *GinWrapper) ForwardRequest(writer http.ResponseWriter, req *http.Request)
- func (w *GinWrapper) ListenAndServeHTTP(addr string, postInit func(port string)) (chan error, *http.Server)
- func (w *GinWrapper) NoRoute(handler WHandlerFunc)
- func (w *GinWrapper) Routes() *GinRoutesWrapper
- func (w *GinWrapper) ServeHTTP(req *http.Request) *httptest.ResponseRecorder
- type HTTPResponse
- func Data(sc int, contentType string, data []byte) HTTPResponse
- func Download(mimetype string, filepath string, filename string) HTTPResponse
- func DownloadData(status int, mimetype string, filename string, data []byte) HTTPResponse
- func ErrWrap(e error, errorType exerr.ErrorType, msg string) HTTPResponse
- func Error(e error) HTTPResponse
- func File(mimetype string, filepath string) HTTPResponse
- func JSON(sc int, data any) HTTPResponse
- func NotImplemented() HTTPResponse
- func Redirect(sc int, newURL string) HTTPResponse
- func Status(sc int) HTTPResponse
- func Text(sc int, data string) HTTPResponse
- type InspectableHTTPResponse
- type Options
- type PreContext
- func (pctx *PreContext) Body(body any) *PreContext
- func (pctx *PreContext) Form(form any) *PreContext
- func (pctx *PreContext) Header(header any) *PreContext
- func (pctx *PreContext) Query(query any) *PreContext
- func (pctx *PreContext) RawBody(rawbody *[]byte) *PreContext
- func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse)
- func (pctx *PreContext) URI(uri any) *PreContext
- func (pctx *PreContext) WithSession(sessionObj SessionObject) *PreContext
- func (pctx *PreContext) WithTimeout(to time.Duration) *PreContext
- type SessionObject
- type WHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyBuffer ¶ added in v0.0.220
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) RequestURI ¶ added in v0.0.173
func (ac *AppContext) RequestURI() string
func (*AppContext) Set ¶ added in v0.0.213
func (ac *AppContext) Set(key, value any)
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
func (*GinRouteBuilder) WithJSONFilter ¶ added in v0.0.279
func (w *GinRouteBuilder) WithJSONFilter(filter string) *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
func (*GinRoutesWrapper) Use ¶ added in v0.0.199
func (w *GinRoutesWrapper) Use(middleware ...gin.HandlerFunc) *GinRoutesWrapper
func (*GinRoutesWrapper) WithJSONFilter ¶ added in v0.0.280
func (w *GinRoutesWrapper) WithJSONFilter(filter string) *GinRoutesWrapper
type GinWrapper ¶
type GinWrapper struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(opt Options) *GinWrapper
NewEngine creates a new (wrapped) ginEngine
func (*GinWrapper) DebugPrintRoutes ¶ added in v0.0.202
func (w *GinWrapper) DebugPrintRoutes()
func (*GinWrapper) ForwardRequest ¶ added in v0.0.417
func (w *GinWrapper) ForwardRequest(writer http.ResponseWriter, req *http.Request)
ForwardRequest manually inserts a request into this router = behaves as if the request came from the outside (and writes the response to `writer`)
func (*GinWrapper) ListenAndServeHTTP ¶ added in v0.0.202
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(req *http.Request) *httptest.ResponseRecorder
ServeHTTP only used for unit tests
type HTTPResponse ¶
type HTTPResponse interface { Write(g *gin.Context) WithHeader(k string, v string) HTTPResponse WithCookie(name string, value string, maxAge int, path string, domain string, secure bool, httpOnly bool) HTTPResponse IsSuccess() bool }
func DownloadData ¶ added in v0.0.221
func DownloadData(status int, mimetype string, filename string, data []byte) HTTPResponse
func ErrWrap ¶ added in v0.0.208
func ErrWrap(e error, errorType exerr.ErrorType, msg string) HTTPResponse
func Error ¶ added in v0.0.207
func Error(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() 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 InspectableHTTPResponse ¶ added in v0.0.349
type Options ¶ added in v0.0.348
type Options struct { AllowCors *bool // Add cors handler to allow all CORS requests on the default http methods GinDebug *bool // Set gin.debug to true (adds more logs) SuppressGinLogs *bool // Suppress our custom gin logs (even if GinDebug == true) BufferBody *bool // Buffers the input body stream, this way the ginext error handler can later include the whole request body Timeout *time.Duration // The default handler timeout ListenerBeforeRequest []func(g *gin.Context) // Register listener that are called before the handler method ListenerAfterRequest []func(g *gin.Context, resp HTTPResponse) // Register listener that are called after the handler method DebugTrimHandlerPrefixes []string // Trim these prefixes from the handler names in the debug print DebugReplaceHandlerNames map[string]string // Replace handler names in debug output }
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) Header ¶ added in v0.0.200
func (pctx *PreContext) Header(header any) *PreContext
func (*PreContext) Query ¶ added in v0.0.173
func (pctx *PreContext) Query(query any) *PreContext
func (*PreContext) RawBody ¶ added in v0.0.299
func (pctx *PreContext) RawBody(rawbody *[]byte) *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
func (*PreContext) WithSession ¶ added in v0.0.326
func (pctx *PreContext) WithSession(sessionObj SessionObject) *PreContext
func (*PreContext) WithTimeout ¶ added in v0.0.239
func (pctx *PreContext) WithTimeout(to time.Duration) *PreContext
type SessionObject ¶ added in v0.0.326
type SessionObject interface { Init(g *gin.Context, ctx *AppContext) error Finish(ctx context.Context, resp HTTPResponse) error }
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
Click to show internal directories.
Click to hide internal directories.