gin

package
v1.7.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: MIT, Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind added in v1.7.6

func Bind(ctx *gin.Context, obj any) error

func Convert

func Convert(handler http.HandlerFunc) gin.HandlerFunc

func Converts

func Converts(handlers []http.HandlerFunc) []gin.HandlerFunc

func ErrorLogger added in v1.7.6

func ErrorLogger() gin.HandlerFunc

ErrorLogger returns a handlerfunc for any error type.

func ErrorLoggerT added in v1.7.6

func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc

ErrorLoggerT returns a handlerfunc for a given error type.

func FromStdWithNext

func FromStdWithNext(h func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)) gin.HandlerFunc

func HandlerWrap

func HandlerWrap[REQ, RES any](service Service[*REQ, *RES]) gin.HandlerFunc

func HandlerWrapGRPC added in v1.3.12

func HandlerWrapGRPC[REQ, RES any](service types.GrpcService[*REQ, *RES]) gin.HandlerFunc

func Logger added in v1.7.6

func Logger() gin.HandlerFunc

Logger instances a Logger middleware that will write the logs to gin.DefaultWriter. By default gin.DefaultWriter = os.Stdout.

func LoggerWithConfig added in v1.7.6

func LoggerWithConfig(conf httpx.LoggerConfig) gin.HandlerFunc

LoggerWithConfig instance a Logger middleware with config.

func LoggerWithFormatter added in v1.7.6

func LoggerWithFormatter(f httpx.Formatter, logger *log.Logger, hasErr bool) gin.HandlerFunc

LoggerWithFormatter instance a Logger middleware with the specified log format function.

func Respond added in v1.6.6

func Respond(ctx *gin.Context, v any)

func SetLog added in v1.7.6

func SetLog(app *gin.Engine, logger2 *log.Logger, errHandle bool)

func Wrap

func Wrap(handler interface{}) gin.HandlerFunc

Wrap converts native http.Handler & http.HandlerFunc to gin.HandlerFunc.

Supported form types:

.Wrap(h http.Handler)
.Wrap(func(w http.ResponseWriter, r *http.Request))
.Wrap(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc))

Types

type RequestSource added in v1.7.6

type RequestSource struct {
	*gin.Context
}

func (RequestSource) Body added in v1.7.7

func (s RequestSource) Body() (string, io.ReadCloser)

func (RequestSource) Form added in v1.7.7

func (s RequestSource) Form() kvstruct.Setter

func (RequestSource) Header added in v1.7.6

func (s RequestSource) Header() kvstruct.Setter

func (RequestSource) Query added in v1.7.6

func (s RequestSource) Query() kvstruct.Setter

func (RequestSource) Uri added in v1.7.6

func (s RequestSource) Uri() kvstruct.Setter

type Service added in v1.3.9

type Service[REQ, RES any] func(*gin.Context, REQ) (RES, *httpx.ErrResp)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL