Documentation
¶
Index ¶
Constants ¶
View Source
const AdminRoleName = "admin"
View Source
const UserRoleName = "user"
Variables ¶
This section is empty.
Functions ¶
func Casbin ¶
func Casbin() gin.HandlerFunc
func GalleryPermission ¶
func GalleryPermission() gin.HandlerFunc
Types ¶
type FileProgress ¶
type FileProgress struct {
FileName string
FileSize int64
Readed int64
UploadID string
LastSent time.Time
}
FileProgress 跟踪单个文件的上传进度
type ProgressReader ¶
type ProgressReader struct {
Size int64
Readed int64
UserID uint
Hub *websocket.Hub
LastSent time.Time
TotalSent bool
// contains filtered or unexported fields
}
ProgressReader 包装了io.Reader,用于跟踪文件读取进度
func (*ProgressReader) Close ¶
func (pr *ProgressReader) Close() error
Close 实现io.Closer接口,关闭底层的reader
type RateLimitConfig ¶
type RateLimitConfig struct {
Limit int // 时间窗口内允许的最大请求数
WindowSize time.Duration // 时间窗口大小
KeyFunc func(*gin.Context) string // 生成速率限制键的函数
}
RateLimitConfig 速率限制配置
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter 速率限制器
func NewRateLimiter ¶
func NewRateLimiter(config *RateLimitConfig) *RateLimiter
NewRateLimiter 创建新的速率限制器
type UploadProgressMiddleware ¶
UploadProgressMiddleware 上传进度跟踪中间件
func NewUploadProgressMiddleware ¶
func NewUploadProgressMiddleware(hub *websocket.Hub) *UploadProgressMiddleware
NewUploadProgressMiddleware 创建上传进度中间件实例
func (*UploadProgressMiddleware) Handle ¶
func (m *UploadProgressMiddleware) Handle() gin.HandlerFunc
Handle 处理上传进度跟踪
Click to show internal directories.
Click to hide internal directories.