middleware

package
v0.0.0-...-8406b6b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog

func AccessLog() gin.HandlerFunc

func AppInfo

func AppInfo() gin.HandlerFunc

func ContextTimeout

func ContextTimeout(t time.Duration) func(c *gin.Context)

ContextTimeout 超时控制

func JWT

func JWT() gin.HandlerFunc

func RateLimiter

func RateLimiter(l limiter.LimiterIface) gin.HandlerFunc

RateLimiter 限流器 入参应该为 LimiterIface 接口类型,这样子的话只要符合该接口类型的具体限流器实现都可以传入并使用

func Recovery

func Recovery() gin.HandlerFunc

func RecoveryPrint

func RecoveryPrint() gin.HandlerFunc

func Tracing

func Tracing() func(c *gin.Context)

Tracing 让每次接口调用都能上报到追踪系统中

func Translations

func Translations() gin.HandlerFunc

Types

type AccessLogWriter

type AccessLogWriter struct {
	// 这是继承实现的语法
	gin.ResponseWriter // 实现了 WriteHeader
	// contains filtered or unexported fields
}

AccessLogWriter 实现 http.ResponseWriter

type ResponseWriter interface {
	Header() http.Header
	Write([]byte) (int, error)
	WriteHeader(statusCode int)
}

func (AccessLogWriter) Write

func (w AccessLogWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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