Documentation ¶
Index ¶
- func CreateSystemAdmin(roleId uint)
- func CreateSystemAdminPermission(perms []*validates.PermissionRequest) []uint
- func CreateSystemData(perms []*validates.PermissionRequest)
- func DelAllData()
- func DropTables()
- func GetAll(string, orderBy string, offset, limit int) *gorm.DB
- func GetPermissionsForUser(uid uint) [][]string
- func GetRolesForUser(uid uint) []string
- func IsNotFound(err error)
- func Update(v, d interface{}) error
- func UserAdminLogout(userId uint) bool
- type OauthToken
- type Permission
- type Role
- type Stream
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSystemAdmin ¶
func CreateSystemAdmin(roleId uint)
* *创建系统管理员 *@param role_id uint *@return *models.AdminUserTranform api格式化后的数据格式
func CreateSystemAdminPermission ¶
func CreateSystemAdminPermission(perms []*validates.PermissionRequest) []uint
*
- 创建系统权限
- @return
func CreateSystemData ¶
func CreateSystemData(perms []*validates.PermissionRequest)
* *初始化系统 账号 权限 角色
func DelAllData ¶
func DelAllData()
func DropTables ¶
func DropTables()
func GetAll ¶
*
- 获取列表
- @method MGetAll
- @param {[type]} string string [description]
- @param {[type]} orderBy string [description]
- @param {[type]} relation string [description]
- @param {[type]} offset int [description]
- @param {[type]} limit int [description]
func GetPermissionsForUser ¶
func GetRolesForUser ¶
func IsNotFound ¶
func IsNotFound(err error)
func UserAdminLogout ¶
* * 用户退出登陆 * @method UserAdminLogout * @param {[type]} ids string [description]
Types ¶
type OauthToken ¶
type OauthToken struct { gorm.Model Token string `gorm:"not null default '' comment('Token') VARCHAR(191)"` UserId uint `gorm:"not null default '' comment('UserId') VARCHAR(191)"` Secret string `gorm:"not null default '' comment('Secret') VARCHAR(191)"` ExpressIn int64 `gorm:"not null default 0 comment('是否是标准库') BIGINT(20)"` Revoked bool }
func (*OauthToken) GetOauthTokenByToken ¶
func (ot *OauthToken) GetOauthTokenByToken(token string)
*
- 通过 token 获取 access_token 记录
- @method GetOauthTokenByToken
- @param {[type]} token string [description]
func (*OauthToken) OauthTokenCreate ¶
func (ot *OauthToken) OauthTokenCreate() *Token
*
- oauth_token
- @method OauthTokenCreate
func (*OauthToken) UpdateOauthTokenByUserId ¶
func (ot *OauthToken) UpdateOauthTokenByUserId(userId uint)
*
- 通过 user_id 更新 oauth_token 记录
- @method UpdateOauthTokenByUserId *@param {[type]} user *OauthToken [description]
type Permission ¶
type Permission struct { gorm.Model Name string `gorm:"not null VARCHAR(191)"` DisplayName string `gorm:"VARCHAR(191)"` Description string `gorm:"VARCHAR(191)"` Act string `gorm:"VARCHAR(191)"` }
func GetAllPermissions ¶
func GetAllPermissions(name, orderBy string, offset, limit int) (permissions []*Permission)
*
- 获取所有的权限
- @method GetAllPermissions
- @param {[type]} name string [description]
- @param {[type]} orderBy string [description]
- @param {[type]} offset int [description]
- @param {[type]} limit int [description]
func NewPermission ¶
func NewPermission(id uint, name, act string) *Permission
func NewPermissionByStruct ¶
func NewPermissionByStruct(jp *validates.PermissionRequest) *Permission
func (*Permission) CreatePermission ¶
func (p *Permission) CreatePermission()
*
- 创建
- @method CreatePermission
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
func (*Permission) DeletePermissionById ¶
func (p *Permission) DeletePermissionById()
*
- 通过 id 删除权限
- @method DeletePermissionById
func (*Permission) GetPermissionById ¶
func (p *Permission) GetPermissionById()
*
- 通过 id 获取 permission 记录
- @method GetPermissionById
- @param {[type]} permission *Permission [description]
func (*Permission) GetPermissionByNameAct ¶
func (p *Permission) GetPermissionByNameAct()
*
- 通过 name 获取 permission 记录
- @method GetPermissionByName
- @param {[type]} permission *Permission [description]
func (*Permission) UpdatePermission ¶
func (p *Permission) UpdatePermission(pj *validates.PermissionRequest)
*
- 更新
- @method UpdatePermission
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
type Role ¶
type Role struct { gorm.Model Name string `gorm:"unique;not null VARCHAR(191)"` DisplayName string `gorm:"VARCHAR(191)"` Description string `gorm:"VARCHAR(191)"` }
func CreateSystemAdminRole ¶
* *创建系统管理员 *@return *models.AdminRoleTranform api格式化后的数据格式
func GetAllRoles ¶
*
- 获取所有的角色
- @method GetAllRole
- @param {[type]} name string [description]
- @param {[type]} orderBy string [description]
- @param {[type]} offset int [description]
- @param {[type]} limit int [description]
func NewRoleByStruct ¶
func NewRoleByStruct(rr *validates.RoleRequest) *Role
func (*Role) CreateRole ¶
*
- 创建
- @method CreateRole
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
func (*Role) GetRoleById ¶
func (r *Role) GetRoleById()
*
- 通过 id 获取 role 记录
- @method GetRoleById
- @param {[type]} role *Role [description]
func (*Role) GetRoleByName ¶
func (r *Role) GetRoleByName()
*
- 通过 name 获取 role 记录
- @method GetRoleByName
- @param {[type]} role *Role [description]
func (*Role) UpdateRole ¶
func (r *Role) UpdateRole(rj *validates.RoleRequest, permIds []uint)
*
- 更新
- @method UpdateRole
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
type User ¶
type User struct { gorm.Model Name string `gorm:"not null VARCHAR(191)"` Username string `gorm:"unique;VARCHAR(191)"` Password string `gorm:"not null VARCHAR(191)"` }
func GetAllUsers ¶
*
- 获取所有的账号
- @method GetAllUser
- @param {[type]} name string [description]
- @param {[type]} username string [description]
- @param {[type]} orderBy string [description]
- @param {[type]} offset int [description]
- @param {[type]} limit int [description]
func NewUserByStruct ¶
func NewUserByStruct(ru *validates.CreateUpdateUserRequest) *User
func (*User) CheckLogin ¶
*
- 判断用户是否登录
- @method CheckLogin
- @param {[type]} id int [description]
- @param {[type]} password string [description]
func (*User) CreateUser ¶
func (u *User) CreateUser(aul *validates.CreateUpdateUserRequest)
*
- 创建
- @method CreateUser
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
func (*User) GetUserById ¶
func (u *User) GetUserById()
func (*User) GetUserByUsername ¶
func (u *User) GetUserByUsername()
func (*User) UpdateUser ¶
func (u *User) UpdateUser(uj *validates.CreateUpdateUserRequest)
*
- 更新
- @method UpdateUser
- @param {[type]} kw string [description]
- @param {[type]} cp int [description]
- @param {[type]} mp int [description]
Click to show internal directories.
Click to hide internal directories.