middleware

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheByRawData

func CacheByRawData(cacheExpire time.Duration, forgetTimeout time.Duration, opts ...cache.Option) gin.HandlerFunc

CacheByRawData 以请求参数 Hash 值为键, 缓存请求结果

func CacheByRequestPath

func CacheByRequestPath(cacheExpire time.Duration, forgetTimeout time.Duration, opts ...cache.Option) gin.HandlerFunc

CacheByRequestPath 以请求 URL.Path 为键, 缓存请求结果

func CacheByRequestURI

func CacheByRequestURI(cacheExpire time.Duration, forgetTimeout time.Duration, opts ...cache.Option) gin.HandlerFunc

CacheByRequestURI 以请求 URL 为键, 缓存请求结果

func CheckBlacklist

func CheckBlacklist(asAPI bool) gin.HandlerFunc

CheckBlacklist 接口黑名单检查

func CheckPathOr404

func CheckPathOr404() gin.HandlerFunc

CheckPathOr404 检查 URL 是否为配置中的路由

func CheckWhitelist

func CheckWhitelist(asAPI bool) gin.HandlerFunc

CheckWhitelist 接口白名单检查

func CounterStats

func CounterStats() map[string]any

func DefaultLogCondition

func DefaultLogCondition(c *gin.Context, elapsed time.Duration) bool

func HTTPCounter

func HTTPCounter(name string) gin.HandlerFunc

HTTPCounter 请求简单计数

func RecoveryWithLog

func RecoveryWithLog(stack bool) gin.HandlerFunc

RecoveryWithLog GinRecovery 及日志 Ref: https://github.com/gin-contrib/zap

func WebLogger

func WebLogger(cond LogCondition) gin.HandlerFunc

WebLogger Web 日志, 记录错误日志, 推送请求日志到接口

Types

type LogCondition

type LogCondition func(c *gin.Context, elapsed time.Duration) bool

LogCondition 日志记录条件计算器

Jump to

Keyboard shortcuts

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