Files
PandaX/base/model/base_model.go
2022-07-16 18:49:57 +08:00

34 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"gorm.io/gorm"
"time"
)
// BaseAutoModel 使用代码生成需要此不能自由命名id
type BaseAutoModel struct {
Id int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
CreatedAt time.Time `gorm:"column:create_time" json:"createTime" form:"createTime"`
UpdatedAt time.Time `gorm:"column:update_time" json:"updateTime" form:"updateTime"`
DeletedAt gorm.DeletedAt `gorm:"column:delete_time" sql:"index" json:"-"`
}
// BaseAutoModelD 表想要硬删除使用他
type BaseAutoModelD struct {
Id int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
CreatedAt time.Time `gorm:"column:create_time" json:"createTime" form:"createTime"`
UpdatedAt time.Time `gorm:"column:update_time" json:"updateTime" form:"updateTime"`
}
type BaseModel struct {
CreatedAt time.Time `gorm:"column:create_time" json:"createTime" form:"createTime"`
UpdatedAt time.Time `gorm:"column:update_time" json:"updateTime" form:"updateTime"`
DeletedAt gorm.DeletedAt `gorm:"column:delete_time" sql:"index" json:"-"`
}
// BaseModelD 硬删除
type BaseModelD struct {
CreatedAt time.Time `gorm:"column:create_time" json:"createTime" form:"create_time"`
UpdatedAt time.Time `gorm:"column:update_time" json:"updateTime" form:"update_time"`
}