重新初始化项目

This commit is contained in:
2023-04-27 15:56:12 +08:00
parent 10546eb629
commit d6e256ef9e
50 changed files with 1255 additions and 308 deletions

View File

@@ -2,8 +2,10 @@ package client
import (
"Lee-WineList/config"
"git.echol.cn/loser/logger"
"git.echol.cn/loser/logger/log"
"git.echol.cn/loser/logger"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)

26
client/redis.go Normal file
View File

@@ -0,0 +1,26 @@
package client
import (
"Lee-WineList/config"
"context"
"git.echol.cn/loser/logger/log"
"github.com/go-redis/redis/v8"
)
var Redis *redis.Client
func InitRedisClient() {
conf := config.Scd.Redis
// 初始化连接
conn := redis.NewClient(&redis.Options{
Addr: conf.GetDSN(),
Password: conf.Password,
DB: conf.Db,
})
if err := conn.Ping(context.Background()).Err(); err != nil {
log.Panicf("Redis连接初始化失败: %v", err)
} else {
log.Debug("Redis连接初始化成功")
}
Redis = conn
}