Documentation ¶
Index ¶
- func GetDemoDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuActionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRoleMenuDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetTablePrefix() string
- func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func SetTablePrefix(prefix string)
- type Demo
- type Demos
- type Menu
- type MenuAction
- type MenuActions
- type MenuResource
- type MenuResources
- type Menus
- type Model
- type Role
- type RoleMenu
- type RoleMenus
- type Roles
- type SchemaDemo
- type SchemaMenu
- type SchemaMenuAction
- type SchemaMenuResource
- type SchemaRole
- type SchemaRoleMenu
- type SchemaUser
- type User
- type UserRole
- type UserRoles
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMenuActionDB ¶
GetMenuActionDB 获取菜单动作存储
func GetMenuResourceDB ¶
GetMenuResourceDB 获取菜单资源存储
func GetRoleMenuDB ¶
GetRoleMenuDB 获取角色菜单关联存储
func GetUserRoleDB ¶
GetUserRoleDB 获取用户角色关联存储
Types ¶
type Demo ¶
type Demo struct { Model RecordID string `gorm:"column:record_id;size:36;index;"` // 记录内码 Code *string `gorm:"column:code;size:50;index;"` // 编号 Name *string `gorm:"column:name;size:100;index;"` // 名称 Memo *string `gorm:"column:memo;size:200;"` // 备注 Status *int `gorm:"column:status;index;"` // 状态(1:启用 2:停用) Creator *string `gorm:"column:creator;size:36;"` // 创建者 }
Demo demo实体
type Menu ¶
type Menu struct { Model RecordID string `gorm:"column:record_id;size:36;index;"` // 记录内码 Name *string `gorm:"column:name;size:50;index;"` // 菜单名称 Sequence *int `gorm:"column:sequence;index;"` // 排序值 Icon *string `gorm:"column:icon;size:255;"` // 菜单图标 Router *string `gorm:"column:router;size:255;"` // 访问路由 Hidden *int `gorm:"column:hidden;index;"` // 隐藏菜单(0:不隐藏 1:隐藏) ParentID *string `gorm:"column:parent_id;size:36;index;"` // 父级内码 ParentPath *string `gorm:"column:parent_path;size:518;index;"` // 父级路径 Creator *string `gorm:"column:creator;size:36;"` // 创建人 }
Menu 菜单实体
type MenuAction ¶
type MenuAction struct { Model MenuID string `gorm:"column:menu_id;size:36;index;"` // 菜单ID Code string `gorm:"column:code;size:50;index;"` // 动作编号 Name string `gorm:"column:name;size:50;"` // 动作名称 }
MenuAction 菜单动作关联实体
func (MenuAction) ToSchemaMenuAction ¶
func (a MenuAction) ToSchemaMenuAction() *schema.MenuAction
ToSchemaMenuAction 转换为菜单动作对象
type MenuActions ¶
type MenuActions []*MenuAction
MenuActions 菜单动作关联实体列表
func (MenuActions) GetByMenuID ¶
func (a MenuActions) GetByMenuID(menuID string) []*schema.MenuAction
GetByMenuID 根据菜单ID获取菜单动作列表
func (MenuActions) ToSchemaMenuActions ¶
func (a MenuActions) ToSchemaMenuActions() []*schema.MenuAction
ToSchemaMenuActions 转换为菜单动作列表
type MenuResource ¶
type MenuResource struct { Model MenuID string `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 (MenuResource) ToSchemaMenuResource ¶
func (a MenuResource) ToSchemaMenuResource() *schema.MenuResource
ToSchemaMenuResource 转换为菜单资源对象
type MenuResources ¶
type MenuResources []*MenuResource
MenuResources 菜单资源关联实体列表
func (MenuResources) GetByMenuID ¶
func (a MenuResources) GetByMenuID(menuID string) []*schema.MenuResource
GetByMenuID 根据菜单ID获取菜单资源列表
func (MenuResources) ToSchemaMenuResources ¶
func (a MenuResources) ToSchemaMenuResources() []*schema.MenuResource
ToSchemaMenuResources 转换为菜单资源列表
type Model ¶
type Model struct { ID uint `gorm:"column:id;primary_key;auto_increment;"` CreatedAt time.Time `gorm:"column:created_at;"` UpdatedAt time.Time `gorm:"column:updated_at;"` DeletedAt *time.Time `gorm:"column:deleted_at;index;"` }
Model base model
type Role ¶
type Role struct { Model RecordID string `gorm:"column:record_id;size:36;index;"` // 记录内码 Name *string `gorm:"column:name;size:100;index;"` // 角色名称 Sequence *int `gorm:"column:sequence;index;"` // 排序值 Memo *string `gorm:"column:memo;size:200;"` // 备注 Creator *string `gorm:"column:creator;size:36;"` // 创建者 }
Role 角色实体
type RoleMenu ¶
type RoleMenu struct { Model RoleID string `gorm:"column:role_id;size:36;index;"` // 角色内码 MenuID string `gorm:"column:menu_id;size:36;index;"` // 菜单内码 Action *string `gorm:"column:action;size:2048;"` // 动作权限(多个以英文逗号分隔) Resource *string `gorm:"column:resource;size:2048;"` // 资源权限(多个以英文逗号分隔) }
RoleMenu 角色菜单关联实体
func (RoleMenu) ToSchemaRoleMenu ¶
ToSchemaRoleMenu 转换为角色菜单对象
type RoleMenus ¶
type RoleMenus []*RoleMenu
RoleMenus 角色菜单关联实体列表
func (RoleMenus) GetByRoleID ¶
GetByRoleID 根据角色ID获取角色菜单对象列表
func (RoleMenus) ToSchemaRoleMenus ¶
ToSchemaRoleMenus 转换为角色菜单对象列表
type SchemaDemo ¶
SchemaDemo demo对象
type SchemaMenu ¶
SchemaMenu 菜单对象
func (SchemaMenu) ToMenuActions ¶
func (a SchemaMenu) ToMenuActions() []*MenuAction
ToMenuActions 转换为菜单动作列表
func (SchemaMenu) ToMenuResources ¶
func (a SchemaMenu) ToMenuResources() []*MenuResource
ToMenuResources 转换为菜单资源列表
type SchemaMenuAction ¶
type SchemaMenuAction schema.MenuAction
SchemaMenuAction 菜单动作对象
func (SchemaMenuAction) ToMenuAction ¶
func (a SchemaMenuAction) ToMenuAction(menuID string) *MenuAction
ToMenuAction 转换为菜单动作实体
type SchemaMenuResource ¶
type SchemaMenuResource schema.MenuResource
SchemaMenuResource 菜单资源对象
func (SchemaMenuResource) ToMenuResource ¶
func (a SchemaMenuResource) ToMenuResource(menuID string) *MenuResource
ToMenuResource 转换为菜单资源实体
type SchemaRole ¶
SchemaRole 角色对象
func (SchemaRole) ToRoleMenus ¶
func (a SchemaRole) ToRoleMenus() []*RoleMenu
ToRoleMenus 转换为角色菜单实体列表
type SchemaRoleMenu ¶
SchemaRoleMenu 角色菜单对象
func (SchemaRoleMenu) ToRoleMenu ¶
func (a SchemaRoleMenu) ToRoleMenu(roleID string) *RoleMenu
ToRoleMenu 转换为角色菜单实体
type SchemaUser ¶
SchemaUser 用户对象
func (SchemaUser) ToUserRoles ¶
func (a SchemaUser) ToUserRoles() []*UserRole
ToUserRoles 转换为用户角色关联列表
type User ¶
type User struct { Model RecordID string `gorm:"column:record_id;size:36;index;"` // 记录内码 UserName *string `gorm:"column:user_name;size:64;index;"` // 用户名 RealName *string `gorm:"column:real_name;size:64;index;"` // 真实姓名 Password *string `gorm:"column:password;size:40;"` // 密码(sha1(md5(明文))加密) Email *string `gorm:"column:email;size:255;index;"` // 邮箱 Phone *string `gorm:"column:phone;size:20;index;"` // 手机号 Status *int `gorm:"column:status;index;"` // 状态(1:启用 2:停用) Creator *string `gorm:"column:creator;size:36;"` // 创建者 }
User 用户实体
type UserRole ¶
type UserRole struct { Model UserID string `gorm:"column:user_id;size:36;index;"` // 用户内码 RoleID string `gorm:"column:role_id;size:36;index;"` // 角色内码 }
UserRole 用户角色关联实体
func (UserRole) ToSchemaUserRole ¶
ToSchemaUserRole 转换为用户角色对象
type UserRoles ¶
type UserRoles []*UserRole
UserRoles 用户角色关联列表
func (UserRoles) GetByUserID ¶
GetByUserID 根据用户ID获取用户角色对象列表
func (UserRoles) ToSchemaUserRoles ¶
ToSchemaUserRoles 转换为用户角色对象列表