Documentation ¶
Index ¶
- Variables
- func CheckCategory(name string) int
- func CheckLogin(username string, password string) int
- func CheckUser(username string) int
- func CreateArt(data *Article) int
- func CreateCategory(data *Category) int
- func CreateUser(data *User) int
- func DeleteArt(id int) int
- func DeleteCategory(id int) int
- func DeleteUser(id int) int
- func EditArt(id int, data *Article) int
- func EditCategory(id int, data *Category) int
- func EditUser(id int, data *User) int
- func InitDb()
- func ScryptPw(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
View Source
var Bucket = utils.Bucket
View Source
var Db *gorm.DB
View Source
var QiniuServer = utils.QiniuServer
View Source
var SecretKey = utils.SecretKey
Functions ¶
func CheckCategory ¶
func CheckLogin ¶
func CreateCategory ¶
func CreateUser ¶
func DeleteCategory ¶
func DeleteUser ¶
func EditCategory ¶
Types ¶
type Article ¶
type Article struct { gorm.Model Title string `gorm:"type:varchar(100);not null" json:"title"` Category Category `gorm:"foreignkey:Cid"` Cid int `gorm:"type:int;not null" json:"cid"` Desc string `gorm:"type:varchar(200)" json:"desc"` Content string `gorm:"type:longtext" json:"content"` Img string `gorm:"type:varchar(100)" json:"img"` }
func GetArtInfo ¶
type Category ¶
type User ¶
type User struct { gorm.Model Username string `gorm:"type:varchar(20);not null" json:"username" validate:"required,min=4,max=12"` Password string `gorm:"type:varchar(20);not null" json:"password" validate:"required,min=6,max=20"` Role int `gorm:"type:int;DEFAULT:2" json:"role" validate:"required,gte=2"` }
Click to show internal directories.
Click to hide internal directories.