You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
492 B
Go

package types
import (
"gorm.io/gorm"
"time"
)
// BaseDbModel 数据库通用字段
type BaseDbModel struct {
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
func (m *BaseDbModel) BeforeCreate(*gorm.DB) (err error) {
m.Id = uuid.New().String()
return
}*/