Files
xlgo-core/model/base.go
T
杭州明婳科技 2dfcbbbb22 init
2026-04-30 23:26:14 +08:00

24 lines
620 B
Go

package model
import (
"time"
"gorm.io/gorm"
)
// BaseModel 基础模型
type BaseModel struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
// BaseModelWithTime 带时间戳的模型
type BaseModelWithTime struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `gorm:"type:datetime" json:"created_at"`
UpdatedAt time.Time `gorm:"type:datetime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}