Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PassWordCost 密码加密难度 PassWordCost = 12 // Active 激活用户 Active string = "active" // Inactive 未激活用户 Inactive string = "inactive" // Suspend 被封禁用户 Suspend string = "suspend" // UserTable ... UserTable string = "users" )
Variables ¶
View Source
var DB *gorm.DB
DB ...
Functions ¶
Types ¶
type CustomeModel ¶
type CustomeModel struct { ID uint `gorm:"primarykey"` CreatedAt uint64 `json:"created_at"` UpdatedAt uint64 `json:"update_at"` DeletedAt uint64 `json:"deleted_at"` IsDelete bool `json:"is_delete"` }
CustomeModel a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt It may be embedded into your model or you may build your own model without it
type User struct { CustomeModel }
type User ¶
type User struct { CustomeModel UserName string `gorm:"type:varchar(30);not null;unique;index:user_name_idx"` PasswordDigest string `json:"password_digest"` Nickname string `gorm:"type:varchar(30);not null;unique;index:nickname_idx"` Status string `json:"status"` Avatar string `gorm:"size:1000"` }
User 用户模型
func (*User) CheckPassword ¶
CheckPassword 校验密码
Click to show internal directories.
Click to hide internal directories.