conn

package
v0.0.0-...-17910ed Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MulanPSL-2.0 Imports: 16 Imported by: 4

Documentation

Index

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

func AutoMigrateAllTable(ctx context.Context) error

AutoMigrateAllTable 创建数据库表结构

func CloseMysqlClient

func CloseMysqlClient(ctx context.Context)

CloseMysqlClient 断开连接

func CloseRabbitMQClient

func CloseRabbitMQClient(ctx context.Context)

CloseRabbitMQClient 关闭连接

func CloseRedisClient

func CloseRedisClient(ctx context.Context)

CloseRedisClient 关闭连接

func GetMySQLClient

func GetMySQLClient(ctx context.Context) *gorm.DB

GetMySQLClient 获取 MySQL 客户端

func GetRabbitMQChannel

func GetRabbitMQChannel(_ context.Context) *amqp091.Channel

GetRabbitMQChannel 获取 RabbitMQ 通道

func GetRedisClient

func GetRedisClient(_ context.Context) *redis.Client

GetRedisClient 获取 Redis 客户端

func GetTusClient

func GetTusClient(_ context.Context) tus_client.TusClient

GetTusClient 获取 tus 客户端

func HasLock

func HasLock(ctx context.Context, key string) bool

HasLock 是否加锁了

func InitialMySQL

func InitialMySQL(ctx context.Context, user, pass, host, port, db string, maxIdea, maxOpen int)

InitialMySQL 初始化 MySQL 连接

func InitialRabbitMQ

func InitialRabbitMQ(ctx context.Context, uri string)

InitialRabbitMQ 初始化 RabbitMQ 连接

func InitialRedis

func InitialRedis(ctx context.Context, addr, passwd string, db int)

InitialRedis 初始化 Redis 连接

func InitialTusClient

func InitialTusClient(ctx context.Context, host string)

InitialTusClient 初始化 tus 客户端

func Lock

func Lock(ctx context.Context, key string, timeout time.Duration) bool

Lock 加锁

func LockWait

func LockWait(ctx context.Context, key string, wait time.Duration) bool

LockWait 加锁

func Unlock

func Unlock(ctx context.Context, key string)

Unlock 解锁

func WaitUnlock

func WaitUnlock(ctx context.Context, key string, max time.Duration) bool

WaitUnlock 等待锁释放

Types

This section is empty.

Jump to

Keyboard shortcuts

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