Documentation ¶
Index ¶
- func CheckRoleName(name string) (bool, error)
- func CheckUsername(username string) (bool, error)
- func CloseDB()
- func GetTree() (dto.FillMenusTree, error)
- func ToDtoRoles(a []*Role) []*dto.Role
- type AuthSwag
- type Menu
- func (a *Menu) Create() error
- func (a *Menu) Delete(id int) error
- func (a *Menu) Find(id int) (*Menu, error)
- func (a Menu) Query(params *dto.MenuQueryParams) (Menus, int, error)
- func (a Menu) TableName() string
- func (a *Menu) ToDtoMenu() *dto.Menu
- func (a *Menu) Update() error
- func (a *Menu) UpdateMenuGetRoles(id int) []int
- type MenuAction
- type MenuActions
- type MenuResource
- type MenuResources
- type Menus
- type Model
- type Role
- func (a *Role) Create(dtoRoleMenus []*dto.RoleMenu) error
- func (a *Role) Delete(id int) error
- func (a *Role) Find(id int) (*Role, error)
- func (a *Role) Query(params *dto.RoleQueryParams) ([]*Role, int, error)
- func (a Role) TableName() string
- func (a *Role) ToDtoRole() *dto.Role
- func (a *Role) Update(dtoRoleMenus []*dto.RoleMenu) error
- type RoleMenu
- type User
- func (a *User) Create(roleIds []int) error
- func (a *User) Delete(id int) error
- func (a *User) Find(id int) (*User, error)
- func (a *User) Query(params *dto.UserQueryParams) ([]*User, int, error)
- func (a User) TableName() string
- func (a *User) ToDtoUser() *dto.User
- func (a *User) Update(roleIds []int) error
- type UserRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRoleName ¶
func CheckUsername ¶
func GetTree ¶
func GetTree() (dto.FillMenusTree, error)
func ToDtoRoles ¶
Types ¶
type Menu ¶
type Menu struct { Model Name *string `gorm:"column:name;"` // 菜单名称 Sequence *int `gorm:"column:sequence;"` // 排序值 Icon *string `gorm:"column:icon;"` // 菜单图标 Router *string `gorm:"column:router;"` // 访问路由 Hidden *int `gorm:"column:hidden;"` // 隐藏菜单(0:不隐藏 1:隐藏) ParentID *int `gorm:"column:parent_id;"` // 父级内码 ParentPath *string `gorm:"column:parent_path;"` // 父级路径 Resources []*MenuResource `gorm:"association_save_reference:false;foreignkey:MenuID;association_foreignkey:ID;"` // 资源列表 Actions []*MenuAction `gorm:"association_save_reference:false;foreignkey:MenuID;association_foreignkey:ID;"` // 动作列表 }
func (*Menu) UpdateMenuGetRoles ¶
type MenuAction ¶
type MenuAction struct { Model MenuID int `gorm:"column:menu_id;int;size:36;index;"` // 菜单ID Code string `gorm:"column:code;size:50;index;"` // 动作编号 Name string `gorm:"column:name;size:50;"` // 动作名称 }
MenuAction 菜单动作关联实体
func (MenuAction) ToPogoMenuActive ¶
func (a MenuAction) ToPogoMenuActive() *dto.MenuAction
type MenuActions ¶
type MenuActions []*MenuAction
MenuActions 菜单动作关联实体列表
func (MenuActions) GetByMenuID ¶
func (a MenuActions) GetByMenuID(menuID int) []*dto.MenuAction
GetByMenuID 根据菜单ID获取菜单动作列表
type MenuResource ¶
type MenuResource struct { Model MenuID int `gorm:"column:menu_id;size:36;index;"` // 菜单ID Code string `gorm:"column:code;size:50;index;"` // 资源编号 Name string `gorm:"column:name;size:50;"` // 资源名称 Method string `gorm:"column:method;size:50;"` // 请求方式 Path string `gorm:"column:path;size:255;"` // 请求路径 }
MenuResource 菜单资源关联实体
func BelongToResource ¶
func BelongToResource(a *dto.MenuResource, menuID int) *MenuResource
转实体Resource
func (*MenuResource) ToPogoMenuResource ¶
func (a *MenuResource) ToPogoMenuResource() *dto.MenuResource
type MenuResources ¶
type MenuResources []*MenuResource
MenuResources 菜单资源关联实体列表
func (MenuResources) GetByMenuID ¶
func (a MenuResources) GetByMenuID(menuID int) []*dto.MenuResource
GetByMenuID 根据菜单ID获取菜单资源列表
type Model ¶
type Role ¶
type Role struct { Model Name *string `gorm:"column:name;"` Memo *string `gorm:"column:memo"` RoleMenus []*RoleMenu `gorm:"association_save_reference:false;"` }
func GetRolesAll ¶
type RoleMenu ¶
type RoleMenu struct { Model RoleID int `gorm:"column:role_id;"` // 角色内码 MenuID int `gorm:"column:menu_id;"` // 菜单内码 Action *string `gorm:"column:action;"` // 动作权限(多个以英文逗号分隔) Resource *string `gorm:"column:resource;"` // 资源权限(多个以英文逗号分隔) }
RoleMenu 角色菜单关联实体
type User ¶
type User struct { Model Username *string `gorm:"column:username"` Password *string `gorm:"column:password"` Nickname *string `gorm:"column:nickname"` Disabled *int `gorm:"column:disabled"` Phone *string `gorm:"column:phone"` Email *string `gorm:"column:email"` Roles []*Role `gorm:"many2many:user_role;"` }
func GetUsersAll ¶
Click to show internal directories.
Click to hide internal directories.