Documentation
¶
Index ¶
- func CheckCategory(name string) int
- func CheckLogin(username string, password string) int
- func CheckUser(user string) int
- func CreateArticle(data *Article) int
- func CreateCategory(data *Category) int
- func CreateUser(data *User) int
- func DeleteArticle(id int) int
- func DeleteCategory(id int) int
- func DeleteUser(id int) int
- func EditArticle(id int, data *Article) int
- func EditCategory(id int, data *Category) int
- func EditUser(id int, data *User) int
- func InitDb()
- func ScryptPassWord(password string) string
- type Article
- type Category
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶
type Article struct {
gorm.Model
Category Category `gorm:"foreignkey:Cid"`
Title string `gorm:"type:varchar(200); not null" json:"title"`
Cid uint `gorm:"type:int; not null" json:"cid"`
Name string `gorm:"type:varchar(20); not null" json:"name"`
Desc string `gorm:"type:varchar(200)" json:"desc"`
Content string `gorm:"type:longtext" json:"content"`
Img string `gorm:"type:varchar(100)" json:"img"`
}
func GetArticleList ¶
GetArticleList 查詢文章列表
type User ¶
type User struct {
gorm.Model
UserName string `gorm:"column:username; type:varchar(20); not null" json:"username" validate:"required,min=3,max=12" label:"帳號"`
PassWord string `gorm:"column:password; type:varchar(20); not null" json:"password" validate:"required,min=6,max=20" label:"密碼"`
Role uint `gorm:"column:role; type:int DEFAULT:2" json:"role" validate:"required,gte=2" label:"權限代碼"`
}
Click to show internal directories.
Click to hide internal directories.