Documentation ¶
Index ¶
- Variables
- func AddArtDao(data *Article) int
- func AddCategoryDao(data *Category) int
- func AddUserDao(data *User) int
- func CheckCategory(name string) (code int)
- func CheckLogin(username, password string) int
- func CheckUser(username string) (code int)
- func DeleteArtDao(id int) int
- func DeleteCategoryDao(id int) int
- func DeleteUserDao(id int) int
- func EditArtDao(id int, a *Article) int
- func EditCategoryDao(id int, c *Category) int
- func EditUserDao(id int, u *User) int
- func InitDB()
- func ScryptPwd(password string) string
- func UploadFile(file multipart.File, fileSize int64) (string, int)
- type Article
- type Category
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AccessKey = utils.AccessKey SecretKey = utils.SecretKey Bucket = utils.Bucket ImgUrl = utils.Qiniuserver )
View Source
var Db *gorm.DB
Functions ¶
Types ¶
type Article ¶
type Article struct { gorm.Model Category Category `gorm:"foreignkey:Cid"` Title string `gorm:"type: varchar(100); not null" json:"title,omitempty"` Cid int `gorm:"type: int;not null" json:"cid,omitempty"` Desc string `gorm:"type: varchar(200)" json:"desc,omitempty"` Content string `gorm:"type: longtext" json:"content,omitempty"` Img string `gorm:"type: varchar(100)" json:"img,omitempty"` }
Article Article
type Category ¶
type Category struct { ID uint `gorm:"primary_key; auto_increment" json:"id"` Name string `gorm:"type: varchar(20); not null " json:"name"` }
Category Category
type User ¶
type User struct { gorm.Model Username string `gorm:"type: varchar(20); not null " json:"username" validate:"required,min=6,max=12" label:"用户名"` Password string `gorm:"type: varchar(20); not null " json:"password" validate:"required,min=6,max=20" label:"密码"` Role int `gorm:"type: int; DEFAULT:2" json:"role" validate:"required,gte=1" label:"权限"` }
User 用户
Click to show internal directories.
Click to hide internal directories.