Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶
type Article struct {
BaseModel
Title string `gorm:"type:varchar(100);not null;comment:标题" json:"title"`
CategoryId int `gorm:"type;int;not null;column:cid;comment:标签编号" json:"c_id""`
Desc string `gorm:"type:varchar(200);comment:描述" json:"desc"`
Content string `gorm:"type:text;comment:内容" json:"content"`
Img string `gorm:"type:varchar(100);comment:图片" json:"img"`
UserId int `gorm:"type:int;not null;comment:用户编号" json:"user_id"`
CommonTimestampsField
CommonSoftDeletesField
}
type BaseModel ¶
type BaseModel struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement;" json:"id,omitempty"`
}
BaseModel 模型基类
type Category ¶
type Category struct {
BaseModel
Name string `gorm:"type:varchar(20);not null;comment:标签名称" json:"name"`
Article []Article
CommonTimestampsField
CommonSoftDeletesField
}
type CommonSoftDeletesField ¶
type CommonSoftDeletesField struct {
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"deleted_at,omitempty"`
}
CommonSoftDeletesField 软删除
type CommonTimestampsField ¶
type CommonTimestampsField struct {
CreatedAt time.Time `gorm:"column:created_at;" json:"created_at,omitempty"`
UpdatedAt time.Time `gorm:"column:updated_at;index;" json:"updated_at,omitempty"`
}
CommonTimestampsField 时间戳
type User ¶
type User struct {
BaseModel
UserName string `gorm:"type:varchar(20);not null;comment:用户名称" json:"user_name" form:"user_name" binding:"required"`
Password string `gorm:"type:varchar(20);not null;comment:密码" json:"password" form:"password" binding:"required"`
Article []Article
CommonTimestampsField
CommonSoftDeletesField
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.