You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
911 B

package directive
import (
"product/backend/module/base"
)
const tableName = moduleName
const (
langDefault = "scratch"
)
//func (m *Model) BeforeSave(db *gorm.DB) (err error) {
// if m.Lang == "" {
// m.Lang = langDefault
// }
// return err
//}
type Body struct {
Title string `gorm:"type:varchar(255)" json:"title"`
Content string `gorm:"type:varchar(4096)" json:"content"`
Remark string `gorm:"type:varchar(255)" json:"remark"`
Lang string `gorm:"type:enum('scratch', 'python', 'cpp', 'go')" json:"lang" binding:"oneof='scratch' 'python' 'cpp' 'go'"`
Order int `gorm:"" json:"order"`
State bool `gorm:"" json:"state"`
}
type Model struct {
Body
base.Model
}
type PostModel struct {
Model
}
type PutModel struct {
Model
ID uint `gorm:"primarykey" json:"id" binding:"required"`
}
func (*Model) TableName() string {
return tableName
}
type GetReq struct {
base.GetReq
}