feat 奇怪的知识1.0.1
This commit is contained in:
37
internal/dao/model/categories.gen.go
Normal file
37
internal/dao/model/categories.gen.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 string `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 == "" {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().String()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -22,7 +22,7 @@ type Question struct {
|
||||
Answer string `gorm:"column:answer;not null;comment:答案" json:"answer"` // 答案
|
||||
Explanation string `gorm:"column:explanation;not null;comment:解析" json:"explanation"` // 解析
|
||||
Difficulty int32 `gorm:"column:difficulty;not null;comment:难度分 0 - 100" json:"difficulty"` // 难度分 0 - 100
|
||||
Category string `gorm:"column:category;not null;comment:分类" json:"category"` // 分类
|
||||
CategorySn string `gorm:"column:category_sn;not null;comment:分类-唯一编号" json:"category_sn"` // 分类-唯一编号
|
||||
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"`
|
||||
|
||||
Reference in New Issue
Block a user