Documentation
¶
Index ¶
- func Bind(ctx *gin.Context, obj any) error
- func Convert(handler http.HandlerFunc) gin.HandlerFunc
- func Converts(handlers []http.HandlerFunc) []gin.HandlerFunc
- func ErrorLogger() gin.HandlerFunc
- func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc
- func FromStdWithNext(h func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)) gin.HandlerFunc
- func HandlerWrap[REQ, RES any](service Service[*REQ, *RES]) gin.HandlerFunc
- func HandlerWrapGRPC[REQ, RES any](service types.GrpcService[*REQ, *RES]) gin.HandlerFunc
- func Logger() gin.HandlerFunc
- func LoggerWithConfig(conf httpx.LoggerConfig) gin.HandlerFunc
- func LoggerWithFormatter(f httpx.Formatter, logger *log.Logger, hasErr bool) gin.HandlerFunc
- func Respond(ctx *gin.Context, v any)
- func SetLog(app *gin.Engine, logger2 *log.Logger, errHandle bool)
- func Wrap(handler interface{}) gin.HandlerFunc
- type RequestSource
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
LoggerWithFormatter instance a Logger middleware with the specified log format function.
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
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
Click to show internal directories.
Click to hide internal directories.