entity

package
v0.0.0-...-831d175 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDemoDB

func GetDemoDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetDemoDB 获取demo存储

func GetMenuActionDB

func GetMenuActionDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetMenuActionDB 获取菜单动作存储

func GetMenuDB

func GetMenuDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetMenuDB 获取菜单存储

func GetMenuResourceDB

func GetMenuResourceDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetMenuResourceDB 获取菜单资源存储

func GetRoleDB

func GetRoleDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetRoleDB 获取角色存储

func GetRoleMenuDB

func GetRoleMenuDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetRoleMenuDB 获取角色菜单关联存储

func GetTablePrefix

func GetTablePrefix() string

GetTablePrefix 获取表名前缀

func GetUserDB

func GetUserDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetUserDB 获取用户存储

func GetUserRoleDB

func GetUserRoleDB(ctx context.Context, defDB *gormplus.DB) *gormplus.DB

GetUserRoleDB 获取用户角色关联存储

func SetTablePrefix

func SetTablePrefix(prefix string)

SetTablePrefix 设定表名前缀

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实体

func (Demo) String

func (a Demo) String() string

func (Demo) TableName

func (a Demo) TableName() string

TableName 表名

func (Demo) ToSchemaDemo

func (a Demo) ToSchemaDemo() *schema.Demo

ToSchemaDemo 转换为demo对象

type Demos

type Demos []*Demo

Demos demo列表

func (Demos) ToSchemaDemos

func (a Demos) ToSchemaDemos() []*schema.Demo

ToSchemaDemos 转换为demo对象列表

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 菜单实体

func (a Menu) String() string
func (a Menu) TableName() string

TableName 表名

func (a Menu) ToSchemaMenu() *schema.Menu

ToSchemaMenu 转换为菜单对象

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 (a MenuAction) TableName() string

TableName 表名

func (a MenuAction) ToSchemaMenuAction() *schema.MenuAction

ToSchemaMenuAction 转换为菜单动作对象

type MenuActions []*MenuAction

MenuActions 菜单动作关联实体列表

func (a MenuActions) GetByMenuID(menuID string) []*schema.MenuAction

GetByMenuID 根据菜单ID获取菜单动作列表

func (a MenuActions) ToMap() map[string]*MenuAction

ToMap 转换为键值映射

func (a MenuActions) ToSchemaMenuActions() []*schema.MenuAction

ToSchemaMenuActions 转换为菜单动作列表

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 (a MenuResource) TableName() string

TableName 表名

func (a MenuResource) ToSchemaMenuResource() *schema.MenuResource

ToSchemaMenuResource 转换为菜单资源对象

type MenuResources []*MenuResource

MenuResources 菜单资源关联实体列表

func (a MenuResources) GetByMenuID(menuID string) []*schema.MenuResource

GetByMenuID 根据菜单ID获取菜单资源列表

func (a MenuResources) ToMap() map[string]*MenuResource

ToMap 转换为键值映射

func (a MenuResources) ToSchemaMenuResources() []*schema.MenuResource

ToSchemaMenuResources 转换为菜单资源列表

type Menus []*Menu

Menus 菜单实体列表

func (a Menus) ToSchemaMenus() []*schema.Menu

ToSchemaMenus 转换为菜单对象列表

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

func (Model) TableName

func (Model) TableName(name string) string

TableName table name

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 角色实体

func (Role) String

func (a Role) String() string

func (Role) TableName

func (a Role) TableName() string

TableName 表名

func (Role) ToSchemaRole

func (a Role) ToSchemaRole() *schema.Role

ToSchemaRole 转换为角色对象

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) TableName

func (a RoleMenu) TableName() string

TableName 表名

func (RoleMenu) ToSchemaRoleMenu

func (a RoleMenu) ToSchemaRoleMenu() *schema.RoleMenu

ToSchemaRoleMenu 转换为角色菜单对象

type RoleMenus

type RoleMenus []*RoleMenu

RoleMenus 角色菜单关联实体列表

func (RoleMenus) GetByRoleID

func (a RoleMenus) GetByRoleID(roleID string) []*schema.RoleMenu

GetByRoleID 根据角色ID获取角色菜单对象列表

func (RoleMenus) ToMap

func (a RoleMenus) ToMap() map[string]*RoleMenu

ToMap 转换为键值映射

func (RoleMenus) ToSchemaRoleMenus

func (a RoleMenus) ToSchemaRoleMenus() []*schema.RoleMenu

ToSchemaRoleMenus 转换为角色菜单对象列表

type Roles

type Roles []*Role

Roles 角色实体列表

func (Roles) ToSchemaRoles

func (a Roles) ToSchemaRoles() []*schema.Role

ToSchemaRoles 转换为角色对象列表

type SchemaDemo

type SchemaDemo schema.Demo

SchemaDemo demo对象

func (SchemaDemo) ToDemo

func (a SchemaDemo) ToDemo() *Demo

ToDemo 转换为demo实体

type SchemaMenu

type SchemaMenu schema.Menu

SchemaMenu 菜单对象

func (SchemaMenu) ToMenu

func (a SchemaMenu) ToMenu() *Menu

ToMenu 转换为菜单实体

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

type SchemaRole schema.Role

SchemaRole 角色对象

func (SchemaRole) ToRole

func (a SchemaRole) ToRole() *Role

ToRole 转换为角色实体

func (SchemaRole) ToRoleMenus

func (a SchemaRole) ToRoleMenus() []*RoleMenu

ToRoleMenus 转换为角色菜单实体列表

type SchemaRoleMenu

type SchemaRoleMenu schema.RoleMenu

SchemaRoleMenu 角色菜单对象

func (SchemaRoleMenu) ToRoleMenu

func (a SchemaRoleMenu) ToRoleMenu(roleID string) *RoleMenu

ToRoleMenu 转换为角色菜单实体

type SchemaUser

type SchemaUser schema.User

SchemaUser 用户对象

func (SchemaUser) ToUser

func (a SchemaUser) ToUser() *User

ToUser 转换为用户实体

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 用户实体

func (User) String

func (a User) String() string

func (User) TableName

func (a User) TableName() string

TableName 表名

func (User) ToSchemaUser

func (a User) ToSchemaUser() *schema.User

ToSchemaUser 转换为用户对象

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) TableName

func (a UserRole) TableName() string

TableName 表名

func (UserRole) ToSchemaUserRole

func (a UserRole) ToSchemaUserRole() *schema.UserRole

ToSchemaUserRole 转换为用户角色对象

type UserRoles

type UserRoles []*UserRole

UserRoles 用户角色关联列表

func (UserRoles) GetByUserID

func (a UserRoles) GetByUserID(userID string) []*schema.UserRole

GetByUserID 根据用户ID获取用户角色对象列表

func (UserRoles) ToSchemaUserRoles

func (a UserRoles) ToSchemaUserRoles() []*schema.UserRole

ToSchemaUserRoles 转换为用户角色对象列表

type Users

type Users []*User

Users 用户实体列表

func (Users) ToSchemaUsers

func (a Users) ToSchemaUsers() []*schema.User

ToSchemaUsers 转换为用户对象列表

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL