Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GORMExt = addition.GORMExt
GORMExt gorm ext
View Source
var Logger = addition.Logger
Logger logger
Functions ¶
func RegisterUser ¶
func RegisterUser(r *gin.RouterGroup, ri *bulrush.ReverseInject)
RegisterUser inject function
Types ¶
type File ¶
type File struct { Model UID string `gorm:"comment:'标识'"` Name string `gorm:"comment:'名称'"` Type string `gorm:"comment:'类型'"` Status uint `gorm:"comment:'状态'"` Size uint `gorm:"comment:'大小'"` URL string `gorm:"comment:'URL'"` Path null.String `gorm:"comment:'路径'"` }
File defined struct
type Model ¶
type Model struct { ID uint `gorm:"comment:'模型ID';primary_key"` CreatorID uint `gorm:"comment:'创建人ID'"` Creator *User `gorm:"foreignkey:id;association_foreignkey:CreatorID"` CreatedAt *time.Time `gorm:"comment:'创建时间'"` UpdatorID uint `gorm:"comment:'修改人ID'"` Updator *User `gorm:"foreignkey:id;association_foreignkey:UpdatorID"` UpdatedAt *time.Time `gorm:"comment:'更新时间'"` DeleterID uint `gorm:"comment:'删除人ID'"` Deleter *User `gorm:"foreignkey:id;association_foreignkey:DeleterID"` DeletedAt *time.Time `sql:"index" gorm:"comment:'删除时间'"` }
Model defined common field
type Param ¶
type Param struct { Model Code string `gorm:"comment:'编码';unique;not null"` Name string `gorm:"comment:'名称'"` Value []Property `gorm:"foreignkey:ParamID"` }
Param defined struct
type Permission ¶
type Permission struct { Model Code string `gorm:"comment:'编码';unique;not null"` Name string `gorm:"comment:'名称';unique;not null"` Pid uint `gorm:"comment:'父级ID'"` Type string `gorm:"comment:'类型';enum:'一级菜单='101' 二级菜单='102' 三级菜单='103' 按钮='104' 自定义='105''"` Holder string `gorm:"comment:'权限类型';enum:'系统='101' 用户='102'"` Permission *Permission `gorm:"foreignkey:id;association_foreignkey:p_id"` }
Permission defined struct
type Property ¶
type Property struct { Model ParamID uint `gorm:"comment:'Param外键'"` Category string `gorm:"comment:'类别'"` SubCategory string `gorm:"comment:'子类别'"` Key string `gorm:"comment:'属性'"` Value string `gorm:"comment:'属性值'"` }
Property defined struct
type Role ¶
type Role struct { Model Code string `gorm:"comment:'编码';unique;not null"` Name string `gorm:"comment:'名称';unique;not null"` Type string `gorm:"comment:'类型';enum:'管理='101' 业务='102';not null"` Permissions []*Permission `gorm:"comment:'权限列表';many2many:role_permission;"` }
Role defined struct
type Role2User ¶
type Role2User struct { Model UserID uint `gorm:"comment:'用户ID'"` RoleID uint `gorm:"comment:'角色ID'"` }
Role2User defined m2m
type User ¶
type User struct { Model Name string `gorm:"comment:'名称';unique;not null"` Password string `gorm:"comment:'密码';not null"` Salt string `gorm:"comment:'盐噪点';not null"` Age uint `gorm:"comment:'年龄'"` Birthday *time.Time `gorm:"comment:'生日'"` Mobile string `gorm:"comment:'手机'"` Email null.String `gorm:"comment:'邮箱'"` Roles []*Role `gorm:"comment:'角色列表';many2many:role2users;"` Ignored *struct{ Name string } `gorm:"-"` }
User defined struct
func (*User) SetPassword ¶
SetPassword Method to set salt and hash the password for a user
func (*User) ValidPassword ¶
ValidPassword Method to check the entered password is correct or not
Click to show internal directories.
Click to hide internal directories.