master
dtapps 2 months ago
parent b4cf941dd9
commit 8238616ab5

@ -39,14 +39,14 @@ type GormClient struct {
type writer struct{} type writer struct{}
// 日志路径 // 日志路径
var logsUrl = "" var logsURL = ""
func (w writer) Printf(format string, args ...interface{}) { func (w writer) Printf(format string, args ...interface{}) {
now := time.Now() now := time.Now()
logFilePath := "" logFilePath := ""
if dir, err := os.Getwd(); err == nil { if dir, err := os.Getwd(); err == nil {
logFilePath = dir + logsUrl logFilePath = dir + logsURL
} }
if err := os.MkdirAll(logFilePath, 0777); err != nil { if err := os.MkdirAll(logFilePath, 0777); err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())

@ -18,9 +18,9 @@ func NewGormMysqlClient(ctx context.Context, config *GormClientConfig) (*GormCli
// 判断路径 // 判断路径
if c.config.LogPath == "" { if c.config.LogPath == "" {
logsUrl = "/logs/mysql" logsURL = "/logs/mysql"
} else { } else {
logsUrl = c.config.LogPath logsURL = c.config.LogPath
} }
if c.config.LogStatus { if c.config.LogStatus {

@ -19,9 +19,9 @@ func NewGormPostgresClient(ctx context.Context, config *GormClientConfig) (*Gorm
// 判断路径 // 判断路径
if c.config.LogPath == "" { if c.config.LogPath == "" {
logsUrl = "/logs/postgresql" logsURL = "/logs/postgresql"
} else { } else {
logsUrl = c.config.LogPath logsURL = c.config.LogPath
} }
if c.config.LogStatus { if c.config.LogStatus {

@ -19,9 +19,9 @@ func NewGormPostgresqlClient(ctx context.Context, config *GormClientConfig) (*Go
// 判断路径 // 判断路径
if c.config.LogPath == "" { if c.config.LogPath == "" {
logsUrl = "/logs/postgresql" logsURL = "/logs/postgresql"
} else { } else {
logsUrl = c.config.LogPath logsURL = c.config.LogPath
} }
if c.config.LogStatus { if c.config.LogStatus {

@ -5,6 +5,7 @@ import (
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
) )
// HashOperation Hash类型数据操作
type HashOperation struct { type HashOperation struct {
db *redis.Client db *redis.Client
} }

@ -5,6 +5,7 @@ import (
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
) )
// ListOperation 列表(list)类型数据操作
type ListOperation struct { type ListOperation struct {
db *redis.Client db *redis.Client
ctx context.Context ctx context.Context

@ -1,3 +1,4 @@
package dorm package dorm
// Version 版本
const Version = "1.0.57" const Version = "1.0.57"

Loading…
Cancel
Save