middleware

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const BuffSize = 10 * 1024

Variables

This section is empty.

Functions

func ContextTimeout

func ContextTimeout(t time.Duration) gin.HandlerFunc

func Cors

func Cors() gin.HandlerFunc

func Metric added in v1.0.3

func Metric() gin.HandlerFunc

func OKStatus

func OKStatus() gin.HandlerFunc

func Recovery

func Recovery(logger baselogger.Logger) gin.HandlerFunc

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

func SimpleLog

func SimpleLog(logger baselogger.Logger) gin.HandlerFunc

func Timeout

func Timeout(t time.Duration, PanicResBody []byte, TimeoutResBody []byte) gin.HandlerFunc

这个中间件包含mutex的加解锁操作,会导致G暂停,建议仍旧使用ContextTimeout.

func TotalLog

func TotalLog() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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