middleware

package
v0.0.0-...-b89eba7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Body = "body"

Variables

This section is empty.

Functions

func Auth

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

Auth 鉴权中间件,用于解析并写入token

func Cors

func Cors() gin.HandlerFunc

Cors 跨域中间件

func ErrLogMsg

func ErrLogMsg(c *gin.Context) []zap.Field

ErrLogMsg 日志数据

func GetToken

func GetToken(header http.Header) (string, errcode.Err)

GetToken 从当前头部获取token

func GetTokenContent

func GetTokenContent(c *gin.Context) (*model.Content, bool)

GetTokenContent 从当前上下文中获取保存的content内容

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger 接收gin框架默认的日志

func LogBody

func LogBody() gin.HandlerFunc

LogBody 读取body内容缓存下来,为之后打印日志做准备

func MustAccount

func MustAccount() gin.HandlerFunc

MustAccount 必须是账号

func MustUser

func MustUser() gin.HandlerFunc

MustUser 必须是用户

func ParseHeader

func ParseHeader(accessToken string) (*token.Payload, string, errcode.Err)

ParseHeader 获取并解析header中token 返回 payload,token,err

func Recovery

func Recovery(stack bool) gin.HandlerFunc

Recovery recover掉项目可能出现的panic

Types

This section is empty.

Jump to

Keyboard shortcuts

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