feat: client 增删改查
This commit is contained in:
+7
-5
@@ -4,15 +4,17 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/singleflight"
|
||||
"gorm.io/gorm"
|
||||
"sundynix-go/config"
|
||||
)
|
||||
|
||||
// 全局变量 加载在内存中
|
||||
var (
|
||||
Viper *viper.Viper
|
||||
Logger *zap.Logger
|
||||
Config *config.Config
|
||||
DB *gorm.DB
|
||||
Redis redis.UniversalClient
|
||||
Viper *viper.Viper
|
||||
Logger *zap.Logger
|
||||
Config *config.Config
|
||||
DB *gorm.DB
|
||||
Redis redis.UniversalClient
|
||||
ConcurrencyControl = &singleflight.Group{}
|
||||
)
|
||||
|
||||
+4
-4
@@ -6,10 +6,10 @@ import (
|
||||
)
|
||||
|
||||
type BaseModel struct {
|
||||
ID uint `gorm:"primarykey" json:"ID"` // 主键ID
|
||||
CreatedAt time.Time // 创建时间
|
||||
UpdatedAt time.Time // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
|
||||
Id uint `gorm:"primarykey" json:"id"` // 主键ID
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"` // 删除时间
|
||||
}
|
||||
|
||||
// BeforeCreate 定义一个钩子,在创建之前执行自动插入字段
|
||||
|
||||
Reference in New Issue
Block a user