Documentation
¶
Index ¶
- func AccessLogHandler(f func(log *ResponseLog)) gin.HandlerFunc
- func Authorization(ctx *gin.Context) string
- func BadRequestResponse(c *gin.Context, message string, reason ...string)
- func Cors(urls ...string) gin.HandlerFunc
- func CtxGet[T any](ctx *gin.Context, key string) (T, bool)
- func CtxQuery[T any](ctx *gin.Context, key string) (T, bool)
- func CtxQueryInt(ctx *gin.Context, key string, def ...int) int
- func DefaultLog(file string) error
- func ErrorResponse(c *gin.Context, message string, reason ...string)
- func FileDataStream(ctx *gin.Context, file string) error
- func FileStream(ctx *gin.Context, file string)
- func FilterBindErr[T any](err error) error
- func HttpHost(ctx *gin.Context) string
- func HttpLogger(config *lumberjack.Logger) gin.HandlerFunc
- func IsHttps(ctx *gin.Context) bool
- func NoCache() gin.HandlerFunc
- func Recover(isPrintStack, isOutStackErr bool, f func(c *gin.Context, err error)) gin.HandlerFunc
- func Secure() gin.HandlerFunc
- func SuccessResponse(c *gin.Context, data any, message ...string)
- func ValidateHeader[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateHeaderWithFilter[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateJson[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateJsonWithFilter[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateQuery[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateQueryWithFilter[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateUri[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- func ValidateUriWithFilter[T any](f func(ctx *gin.Context, param *T), errFunc ...ValidateErrFunc) func(ctx *gin.Context)
- type Claims
- type GinServer
- type Jwt
- func (j *Jwt[C, T]) CheckJwtToken(tokenString string) (string, error)
- func (j *Jwt[C, T]) GenToken(f func(claims *Claims[C]) *Claims[C], expireTime time.Duration) (string, error)
- func (j *Jwt[C, T]) GetJwtData(c *gin.Context) (T, bool)
- func (j *Jwt[C, T]) Handler(dataFunc func(claims C, token string) (data T, msg string, err error), ...) gin.HandlerFunc
- func (j *Jwt[C, T]) ParseJwtInfo(token string) (C, bool, error)
- type Response
- type ResponseLog
- type ValidateErrFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLogHandler ¶
func AccessLogHandler(f func(log *ResponseLog)) gin.HandlerFunc
AccessLogHandler 获取请求数据log
func Authorization ¶
func DefaultLog ¶
func FileDataStream ¶
FileDataStream 封装返回文件流
func HttpLogger ¶ added in v0.0.5
func HttpLogger(config *lumberjack.Logger) gin.HandlerFunc
func NoCache ¶ added in v0.0.5
func NoCache() gin.HandlerFunc
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response. 强制浏览器不使⽤缓存
func Secure ¶ added in v0.0.5
func Secure() gin.HandlerFunc
Secure is a middleware function that appends security and resource access headers. ⼀些安全设置
func ValidateHeader ¶
func ValidateJson ¶
func ValidateJsonWithFilter ¶
func ValidateQuery ¶
func ValidateQueryWithFilter ¶
func ValidateUri ¶
func ValidateUriWithFilter ¶
Types ¶
type Jwt ¶
func (*Jwt[C, T]) CheckJwtToken ¶
CheckJwtToken 简单校验和过滤token
type ResponseLog ¶
type ValidateErrFunc ¶
Click to show internal directories.
Click to hide internal directories.