Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonFormatMiddleware ¶
func JsonFormatMiddleware(CamelCase bool, UrlPrefix string) gin.HandlerFunc
JsonFormatMiddleware
自动将json数据重新转化为驼峰或者下划线
参数1 CamelCase true 驼峰 false 下划线
参数2 UrlPrefix 前缀 作用的url前缀
Example ¶
r := gin.Default() r.Use(JsonFormatMiddleware(false, "/admin"))
Output:
func JwtVerifyMiddleware ¶
func JwtVerifyMiddleware(RedirectUrl string) gin.HandlerFunc
JwtVerifyMiddleware @description: jwt验证中间件 未授权跳转到登录页面 已授权将uid写入上下文 通过c.Get("uid")获取 @param RedirectUrl string 未授权跳转地址 例如 /admin/login @return gin.HandlerFunc
func LoggerMiddleware ¶
func LoggerMiddleware() gin.HandlerFunc
Types ¶
type ResponseWriterWrapper ¶
type ResponseWriterWrapper struct { gin.ResponseWriter Body *bytes.Buffer // 缓存 CamelCase bool // 真驼峰 假下划线 }
func (ResponseWriterWrapper) WriteString ¶
func (w ResponseWriterWrapper) WriteString(s string) (int, error)
Click to show internal directories.
Click to hide internal directories.