gin

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT, Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

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 Debug

func Debug(r *gin.Engine)

func FromStdWithNext

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

func HandlerWrap added in v0.3.0

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

func HandlerWrapCompatibleGRPC added in v0.3.0

func HandlerWrapCompatibleGRPC[REQ, RES any](service types.GrpcServiceMethod[*REQ, *RES]) gin.HandlerFunc

func Prom

func Prom(r *gin.Engine)

func RespErrRep

func RespErrRep(ctx *gin.Context, rep *errcode.ErrRep)

func RespErrcode

func RespErrcode(ctx *gin.Context, code errcode.ErrCode)

func RespSuccess added in v0.0.28

func RespSuccess[T any](ctx *gin.Context, msg string, data T)

func RespSuccessMsg added in v0.0.28

func RespSuccessMsg(ctx *gin.Context, msg string)

func Response

func Response(ctx *gin.Context, code errcode.ErrCode, msg string, data interface{})

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 Config

type Config gin.Engine

func (*Config) New

func (c *Config) New() *gin.Engine

type ExportService

type ExportService struct{}

type GinService added in v0.3.0

type GinService[REQ, RES any] func(*gin.Context, REQ) (RES, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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