16 lines
493 B
Go
16 lines
493 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// BaseModel 基础模型,所有表内嵌此结构,提供 ID、时间戳、软删除
|
|
type BaseModel struct {
|
|
ID uint `gorm:"primarykey;comment:主键ID" json:"id"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间(软删除)" json:"deleted_at,omitempty"`
|
|
}
|