Documentation ¶
Index ¶
- func GetDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetDBWithModel(ctx context.Context, defDB *gorm.DB, m interface{}) *gorm.DB
- func GetDemoDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuActionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuActionResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetMenuDB(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 GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type Demo
- type Demos
- type Menu
- type MenuAction
- type MenuActionResource
- type MenuActionResources
- type MenuActions
- type Menus
- type Role
- type RoleMenu
- type RoleMenus
- type Roles
- type SchemaDemo
- type SchemaMenu
- type SchemaMenuAction
- type SchemaMenuActionResource
- type SchemaRole
- type SchemaRoleMenu
- type SchemaUser
- type SchemaUserRole
- type User
- type UserRole
- type UserRoles
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDBWithModel ¶
GetDBWithModel ...
func GetMenuActionDB ¶
GetMenuActionDB 菜单动作
func GetMenuActionResourceDB ¶
GetMenuActionResourceDB 菜单动作关联资源
func GetRoleMenuDB ¶
GetRoleMenuDB 角色菜单
Types ¶
type Demo ¶
type Demo struct { ID string `gorm:"column:id;primary_key;size:36;"` Code string `gorm:"column:code;size:50;index;default:'';not null;"` // 编号 Name string `gorm:"column:name;size:100;index;default:'';not null;"` // 名称 Memo *string `gorm:"column:memo;size:200;"` // 备注 Status int `gorm:"column:status;index;default:0;not null;"` // 状态(1:启用 2:停用) Creator string `gorm:"column:creator;size:36;"` // 创建者 CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` DeletedAt *time.Time `gorm:"column:deleted_at;index;"` }
Demo demo实体
type Menu ¶
type Menu struct { ID string `gorm:"column:id;primary_key;size:36;"` Name string `gorm:"column:name;size:50;index;default:'';not null;"` // 菜单名称 Sequence int `gorm:"column:sequence;index;default:0;not null;"` // 排序值 Icon *string `gorm:"column:icon;size:255;"` // 菜单图标 Router *string `gorm:"column:router;size:255;"` // 访问路由 ParentID *string `gorm:"column:parent_id;size:36;index;"` // 父级内码 ParentPath *string `gorm:"column:parent_path;size:518;index;"` // 父级路径 ShowStatus int `gorm:"column:show_status;index;default:0;not null;"` // 状态(1:显示 2:隐藏) Status int `gorm:"column:status;index;default:0;not null;"` // 状态(1:启用 2:禁用) Memo *string `gorm:"column:memo;size:1024;"` // 备注 Creator string `gorm:"column:creator;size:36;"` // 创建人 CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` DeletedAt *time.Time `gorm:"column:deleted_at;index;"` }
Menu 菜单实体
type MenuAction ¶
type MenuAction struct { ID string `gorm:"column:id;primary_key;size:36;"` MenuID string `gorm:"column:menu_id;size:36;index;default:'';not null;"` // 菜单ID Code string `gorm:"column:code;size:100;default:'';not null;"` // 动作编号 Name string `gorm:"column:name;size:100;default:'';not null;"` // 动作名称 }
MenuAction 菜单动作实体
func (MenuAction) ToSchemaMenuAction ¶
func (a MenuAction) ToSchemaMenuAction() *schema.MenuAction
ToSchemaMenuAction 转换为菜单动作对象
type MenuActionResource ¶
type MenuActionResource struct { ID string `gorm:"column:id;primary_key;size:36;"` ActionID string `gorm:"column:action_id;size:36;index;default:'';not null;"` // 菜单动作ID Method string `gorm:"column:method;size:100;default:'';not null;"` // 资源请求方式(支持正则) Path string `gorm:"column:path;size:100;default:'';not null;"` // 资源请求路径(支持/:id匹配) }
MenuActionResource 菜单动作关联资源实体
func (MenuActionResource) ToSchemaMenuActionResource ¶
func (a MenuActionResource) ToSchemaMenuActionResource() *schema.MenuActionResource
ToSchemaMenuActionResource 转换为菜单动作关联资源对象
type MenuActionResources ¶
type MenuActionResources []*MenuActionResource
MenuActionResources 菜单动作关联资源列表
func (MenuActionResources) ToSchemaMenuActionResources ¶
func (a MenuActionResources) ToSchemaMenuActionResources() []*schema.MenuActionResource
ToSchemaMenuActionResources 转换为菜单动作关联资源对象列表
type MenuActions ¶
type MenuActions []*MenuAction
MenuActions 菜单动作列表
func (MenuActions) ToSchemaMenuActions ¶
func (a MenuActions) ToSchemaMenuActions() []*schema.MenuAction
ToSchemaMenuActions 转换为菜单动作对象列表
type Role ¶
type Role struct { ID string `gorm:"column:id;primary_key;size:36;"` Name string `gorm:"column:name;size:100;index;default:'';not null;"` // 角色名称 Sequence int `gorm:"column:sequence;index;default:0;not null;"` // 排序值 Memo *string `gorm:"column:memo;size:1024;"` // 备注 Status int `gorm:"column:status;index;default:0;not null;"` // 状态(1:启用 2:禁用) Creator string `gorm:"column:creator;size:36;"` // 创建者 CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` DeletedAt *time.Time `gorm:"column:deleted_at;index;"` }
Role 角色实体
type RoleMenu ¶
type RoleMenu struct { ID string `gorm:"column:id;primary_key;size:36;"` RoleID string `gorm:"column:role_id;size:36;index;default:'';not null;"` // 角色ID MenuID string `gorm:"column:menu_id;size:36;index;default:'';not null;"` // 菜单ID ActionID string `gorm:"column:action_id;size:36;index;default:'';not null;"` // 动作ID }
RoleMenu 角色菜单实体
func (RoleMenu) ToSchemaRoleMenu ¶
ToSchemaRoleMenu 转换为角色菜单对象
type RoleMenus ¶
type RoleMenus []*RoleMenu
RoleMenus 角色菜单列表
func (RoleMenus) ToSchemaRoleMenus ¶
ToSchemaRoleMenus 转换为角色菜单对象列表
type SchemaDemo ¶
SchemaDemo demo对象
type SchemaMenu ¶
SchemaMenu 菜单对象
type SchemaMenuAction ¶
type SchemaMenuAction schema.MenuAction
SchemaMenuAction 菜单动作
func (SchemaMenuAction) ToMenuAction ¶
func (a SchemaMenuAction) ToMenuAction() *MenuAction
ToMenuAction 转换为菜单动作实体
type SchemaMenuActionResource ¶
type SchemaMenuActionResource schema.MenuActionResource
SchemaMenuActionResource 菜单动作关联资源
func (SchemaMenuActionResource) ToMenuActionResource ¶
func (a SchemaMenuActionResource) ToMenuActionResource() *MenuActionResource
ToMenuActionResource 转换为菜单动作关联资源实体
type SchemaRole ¶
SchemaRole 角色对象
type SchemaRoleMenu ¶
SchemaRoleMenu 角色菜单
func (SchemaRoleMenu) ToRoleMenu ¶
func (a SchemaRoleMenu) ToRoleMenu() *RoleMenu
ToRoleMenu 转换为角色菜单实体
type SchemaUser ¶
SchemaUser 用户对象
type SchemaUserRole ¶
SchemaUserRole 用户角色
func (SchemaUserRole) ToUserRole ¶
func (a SchemaUserRole) ToUserRole() *UserRole
ToUserRole 转换为角色菜单实体
type User ¶
type User struct { ID string `gorm:"column:id;primary_key;size:36;"` UserName string `gorm:"column:user_name;size:64;index;default:'';not null;"` // 用户名 RealName string `gorm:"column:real_name;size:64;index;default:'';not null;"` // 真实姓名 Password string `gorm:"column:password;size:40;default:'';not null;"` // 密码(sha1(md5(明文))加密) Email *string `gorm:"column:email;size:255;index;"` // 邮箱 Phone *string `gorm:"column:phone;size:20;index;"` // 手机号 Status int `gorm:"column:status;index;default:0;not null;"` // 状态(1:启用 2:停用) Creator string `gorm:"column:creator;size:36;"` // 创建者 CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` DeletedAt *time.Time `gorm:"column:deleted_at;index;"` }
User 用户实体
type UserRole ¶
type UserRole struct { ID string `gorm:"column:id;primary_key;size:36;"` UserID string `gorm:"column:user_id;size:36;index;default:'';not null;"` // 用户内码 RoleID string `gorm:"column:role_id;size:36;index;default:'';not null;"` // 角色内码 }
UserRole 用户角色关联实体
func (UserRole) ToSchemaUserRole ¶
ToSchemaUserRole 转换为用户角色对象
type UserRoles ¶
type UserRoles []*UserRole
UserRoles 用户角色关联列表
func (UserRoles) ToSchemaUserRoles ¶
ToSchemaUserRoles 转换为用户角色对象列表