Documentation ¶
Index ¶
- func Access(ng engine.Engine) gin.HandlerFunc
- func AddWrapHandlerCtxFn(c *gin.Context, fns ...wrapHandlerCtxFn)
- func DisablePBValidate(b bool) func(c *gin.Context)
- func ExtractLogger(c *gin.Context) *logrus.Entry
- func ExtractTracerID(c *gin.Context) string
- func ExtractbroccoliCtx(c *gin.Context) context.Context
- func GenerateGinHandle(handleFunc interface{}) func(c *gin.Context)
- func GinRecovery() gin.HandlerFunc
- func GinRecoveryWithWriter(out io.Writer) gin.HandlerFunc
- func Method(groups map[string]*gin.RouterGroup, r *Route)
- func NotFound(ng engine.Engine) gin.HandlerFunc
- func Recovery() gin.HandlerFunc
- func SetDefaultValidator(v binding.StructValidator)
- func SetReWriteErrFn(f reWriteErrFn) func(c *gin.Context)
- func SetReWriteResponseFn(f reWriteResponseFn) func(c *gin.Context)
- func TagRawRsp(raw bool) func(c *gin.Context)
- func UseGinBindValidateForPB(b bool) func(c *gin.Context)
- func WrapHandlerCtx(fns ...wrapHandlerCtxFn) func(c *gin.Context)
- type CustomRouteFn
- type ErrorResponseHandler
- type Route
- type RouteLink
- type SuccessResponseHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWrapHandlerCtxFn ¶
AddWrapHandlerCtxFn 增加handlerctx包装器
func DisablePBValidate ¶
DisablePBValidate 对实现validate接口的pb.message禁用pb数据校验
func ExtractTracerID ¶
func GenerateGinHandle ¶
func GinRecoveryWithWriter ¶
func GinRecoveryWithWriter(out io.Writer) gin.HandlerFunc
GinRecoveryWithWriter 使用gin框架默认的RecoveryWithWriter
func SetDefaultValidator ¶
func SetDefaultValidator(v binding.StructValidator)
SetCustomValidator 设置gin默认的数据校验器
v为nil则使用框架定义的校验器
func SetReWriteErrFn ¶
SetReWriteErrFn 自定义错误处理
func SetReWriteResponseFn ¶
SetReWriteResponseFn 自定义返回处理
func UseGinBindValidateForPB ¶
UseGinBindValidateForPB 使用gin bind对pb进行数据绑定和校验
func WrapHandlerCtx ¶
WrapHandlerCtx 包装handler ctx,支持多个包装器(通过gin中间件添加)
Types ¶
type CustomRouteFn ¶
type ErrorResponseHandler ¶
var ErrorResponse ErrorResponseHandler = defaultErrorResponse
type Route ¶
type Route struct { RLink RouteLink Method string Path string Group string Middlewares gin.HandlersChain Handle gin.HandlerFunc }
func (*Route) AddMW ¶
func (r *Route) AddMW(h ...gin.HandlerFunc)
func (*Route) Mix ¶
func (r *Route) Mix() gin.HandlersChain
type RouteLink ¶
type RouteLink string
type SuccessResponseHandler ¶
var SuccessResponse SuccessResponseHandler = defaultSuccessResponse
Click to show internal directories.
Click to hide internal directories.