38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.hlsq.asia/mmorpg/service-common/utils"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const TableNameCategory = "categories"
|
|
|
|
// Category mapped from table <categories>
|
|
type Category struct {
|
|
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
|
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
|
Category string `gorm:"column:category;not null;comment:分类" json:"category"` // 分类
|
|
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
|
}
|
|
|
|
// TableName Category's table name
|
|
func (*Category) TableName() string {
|
|
return TableNameCategory
|
|
}
|
|
|
|
// Auto sn
|
|
func (m *Category) BeforeCreate(_ *gorm.DB) error {
|
|
if m.Sn == 0 {
|
|
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
|
}
|
|
return nil
|
|
}
|