Documentation ¶
Index ¶
- Constants
- Variables
- func Cors() gin.HandlerFunc
- func GetRequestIDFromContext(c *gin.Context) string
- func Logger() gin.HandlerFunc
- func LoggerWithColor() gin.HandlerFunc
- func LoggerWithConfig(enableColor bool) gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Recovery() gin.HandlerFunc
- func RecoveryWithHandle(handle gin.RecoveryFunc) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
- func Secure(c *gin.Context)
Constants ¶
View Source
const XRequestIDKey = "X-Request-ID"
Variables ¶
View Source
var Store = map[string]gin.HandlerFunc{ "Recovery": Recovery(), "Secure": Secure, "NoCache": NoCache, "Cors": Cors(), "Logger": Logger(), "LoggerWithColor": LoggerWithColor(), }
Store 注册中间件的商店。
Functions ¶
func GetRequestIDFromContext ¶
GetRequestIDFromContext returns 'RequestID' from the given context if present.
func LoggerWithConfig ¶
func LoggerWithConfig(enableColor bool) gin.HandlerFunc
LoggerWithConfig 实例一个带有 config 的 Logger 中间件。
func RecoveryWithHandle ¶
func RecoveryWithHandle(handle gin.RecoveryFunc) gin.HandlerFunc
func RequestID ¶
func RequestID() gin.HandlerFunc
RequestID 是一个中间件,它将“X-Request-ID”注入每个请求的上下文和请求/响应标头中。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.