Documentation ¶
Index ¶
- Constants
- func AutoMigrateAllTable(ctx context.Context) error
- func CloseMysqlClient(ctx context.Context)
- func CloseRabbitMQClient(ctx context.Context)
- func CloseRedisClient(ctx context.Context)
- func GetMySQLClient(ctx context.Context) *gorm.DB
- func GetRabbitMQChannel(_ context.Context) *amqp091.Channel
- func GetRedisClient(_ context.Context) *redis.Client
- func GetTusClient(_ context.Context) tus_client.TusClient
- func HasLock(ctx context.Context, key string) bool
- func InitialMySQL(ctx context.Context, user, pass, host, port, db string, maxIdea, maxOpen int)
- func InitialRabbitMQ(ctx context.Context, uri string)
- func InitialRedis(ctx context.Context, addr, passwd string, db int)
- func InitialTusClient(ctx context.Context, host string)
- func Lock(ctx context.Context, key string, timeout time.Duration) bool
- func LockWait(ctx context.Context, key string, wait time.Duration) bool
- func Unlock(ctx context.Context, key string)
- func WaitUnlock(ctx context.Context, key string, max time.Duration) bool
Constants ¶
View Source
const ( // CacheKey_LockFmt 分布式锁键格式 CacheKey_LockFmt = "lock:%s:string" // CacheKey_UploadFiles 分片上传文件 CacheKey_UploadFiles = "upload:files:hash" // CacheKey_GenIdFmt 记录唯一id缓存键 CacheKey_GenIdFmt = "gen:id:%s:set" // CacheKey_UploadPartFmt 分片上传信息 CacheKey_UploadPartFmt = "upload:part:%s:sset" // CacheKey_CronRecordFmt 定时任务记录 CacheKey_CronRecordFmt = "cron:%s:%s" // CacheKey_UserSessionFmt 用户会话 CacheKey_UserSessionFmt = "user:session:%s:%s:string" // CacheKey_UserLoginFailTimesFmt 登陆失败次数记录 CacheKey_UserLoginFailTimesFmt = "user:login:fail:times:%s:string" )
View Source
const ( LockKey_UserRegisterFmt = "user:register:%s" LockKey_UserChangeAvatarFmt = "user:change:avatar:%d" LockKey_UserLoginFmt = "user:login:%d" LockKey_OpenApiCreateFmt = "openapi:create:%d:%s" )
Variables ¶
This section is empty.
Functions ¶
func AutoMigrateAllTable ¶
AutoMigrateAllTable 创建数据库表结构
func GetRabbitMQChannel ¶
GetRabbitMQChannel 获取 RabbitMQ 通道
func GetRedisClient ¶
GetRedisClient 获取 Redis 客户端
func GetTusClient ¶
func GetTusClient(_ context.Context) tus_client.TusClient
GetTusClient 获取 tus 客户端
func InitialMySQL ¶
InitialMySQL 初始化 MySQL 连接
func InitialRabbitMQ ¶
InitialRabbitMQ 初始化 RabbitMQ 连接
func InitialRedis ¶
InitialRedis 初始化 Redis 连接
func InitialTusClient ¶
InitialTusClient 初始化 tus 客户端
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.