Documentation
¶
Index ¶
- func CasbinHandler() gin.HandlerFunc
- func Cors() gin.HandlerFunc
- func DefaultCheckOrMark(key string, expire int, limit int) (err error)
- func DefaultGenerationKey(c *gin.Context) string
- func DefaultLimit() gin.HandlerFunc
- func GinLogger() gin.HandlerFunc
- func GinRecovery(stack bool) gin.HandlerFunc
- func JwtToken(isNeed bool) gin.HandlerFunc
- func LoadTls() gin.HandlerFunc
- func NeedInit() gin.HandlerFunc
- func OperationRecord() gin.HandlerFunc
- func SetLimitWithTime(key string, limit int, expiration time.Duration) error
- type LimitConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGenerationKey ¶
DefaultGenerationKey 默认生成key
func DefaultLimit ¶
func DefaultLimit() gin.HandlerFunc
func GinRecovery ¶
func GinRecovery(stack bool) gin.HandlerFunc
GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志
func LoadTls ¶
func LoadTls() gin.HandlerFunc
func OperationRecord ¶
func OperationRecord() gin.HandlerFunc
Types ¶
type LimitConfig ¶
type LimitConfig struct {
// GenerationKey 根据业务生成key 下面CheckOrMark查询生成
GenerationKey func(c *gin.Context) string
// 检查函数,用户可修改具体逻辑,更加灵活
CheckOrMark func(key string, expire int, limit int) error
// Expire key 过期时间
Expire int
// Limit 周期时间
Limit int
}
func (LimitConfig) LimitWithTime ¶
func (l LimitConfig) LimitWithTime() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.