🎨 优化model和日志,完善配置文件
parent
8c5fa60081
commit
6945e6db93
@ -1,20 +1,20 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BaseDbModel 数据库通用字段
|
||||
type BaseDbModel struct {
|
||||
Id string `json:"id" gorm:"type:varchar(50);primarykey"`
|
||||
CreatedAt DateTime `json:"createdAt"`
|
||||
UpdatedAt DateTime `json:"updatedAt"`
|
||||
ID uint `gorm:"type:int(11);primarykey;" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index:deleted"`
|
||||
}
|
||||
|
||||
// BeforeCreate 创建数据库对象之前生成UUID
|
||||
/*// BeforeCreate 创建数据库对象之前生成UUID
|
||||
func (m *BaseDbModel) BeforeCreate(*gorm.DB) (err error) {
|
||||
m.Id = uuid.New().String()
|
||||
return
|
||||
}
|
||||
}*/
|
||||
|
Loading…
Reference in New Issue