entity

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPermissionActionDB

func GetPermissionActionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetPermissionActionDB - Get permission action storage

func GetPermissionDB

func GetPermissionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetPermissionDB - Get permission storage

func GetPermissionResourceDB

func GetPermissionResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetPermissionResourceDB - Get permission resource storage

func GetRoleDB

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

GetRoleDB - Get the role store

func GetRolePermissionDB

func GetRolePermissionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetRolePermissionDB - Get the role permission associative storage

func GetUserDB

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

GetUserDB - Get user storage

func GetUserRoleDB

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

GetUserRoleDB - Get user role association storage

Types

type Permission

type Permission struct {
	entity.Model
	UUID       string  `gorm:"column:record_id;size:36;index;"`    // Record internal code
	Name       *string `gorm:"column:name;size:50;index;"`         // Permission name
	Sequence   *int    `gorm:"column:sequence;index;"`             // Sort value
	Icon       *string `gorm:"column:icon;size:255;"`              // Permission icon
	Router     *string `gorm:"column:router;size:255;"`            // Access routing
	Hidden     *int    `gorm:"column:hidden;index;"`               // Hide permission (0: don't hide 1: hide)
	ParentID   *string `gorm:"column:parent_id;size:36;index;"`    // Parent inner code
	ParentPath *string `gorm:"column:parent_path;size:518;index;"` // Parent path
	Creator    *string `gorm:"column:creator;size:36;"`            // Creator
}

Permission - Permission entity

func (Permission) String

func (a Permission) String() string

func (Permission) TableName

func (a Permission) TableName() string

TableName - Table Name

func (Permission) ToSchemaPermission

func (a Permission) ToSchemaPermission() *schema.Permission

ToSchemaPermission - Convert to permission object

type PermissionAction

type PermissionAction struct {
	entity.Model
	PermissionID string `gorm:"column:permission_id;size:36;index;"` // Permission ID
	Code         string `gorm:"column:code;size:50;index;"`          // Action number
	Name         string `gorm:"column:name;size:50;"`                // Action name
}

PermissionAction - Permission action associated entity

func (PermissionAction) TableName

func (a PermissionAction) TableName() string

TableName - Table Name

func (PermissionAction) ToSchemaPermissionAction

func (a PermissionAction) ToSchemaPermissionAction() *schema.PermissionAction

ToSchemaPermissionAction - Convert to permission action object

type PermissionActions

type PermissionActions []*PermissionAction

PermissionActions - Permission action associated entity list

func (PermissionActions) GetByPermissionID

func (a PermissionActions) GetByPermissionID(permissionID string) []*schema.PermissionAction

GetByPermissionID - Get permission action list based on permission ID

func (PermissionActions) ToMap

func (a PermissionActions) ToMap() map[string]*PermissionAction

ToMap - Convert to key-value mapping

func (PermissionActions) ToSchemaPermissionActions

func (a PermissionActions) ToSchemaPermissionActions() []*schema.PermissionAction

ToSchemaPermissionActions - Convert to permission action list

type PermissionResource

type PermissionResource struct {
	entity.Model
	PermissionID string `gorm:"column:permission_id;size:36;index;"` // Permission ID
	Code         string `gorm:"column:code;size:50;index;"`          // Resource number
	Name         string `gorm:"column:name;size:50;"`                // Resource Name
	Method       string `gorm:"column:method;size:50;"`              // Request method
	Path         string `gorm:"column:path;size:255;"`               // Request path
}

PermissionResource - Permission resource associated entity

func (PermissionResource) TableName

func (a PermissionResource) TableName() string

TableName - Table Name

func (PermissionResource) ToSchemaPermissionResource

func (a PermissionResource) ToSchemaPermissionResource() *schema.PermissionResource

ToSchemaPermissionResource - Convert to permission resource object

type PermissionResources

type PermissionResources []*PermissionResource

PermissionResources - Permission resource associated entity list

func (PermissionResources) GetByPermissionID

func (a PermissionResources) GetByPermissionID(permissionID string) []*schema.PermissionResource

GetByPermissionID - Get permission resource list according to permission ID

func (PermissionResources) ToMap

ToMap - Convert to key-value mapping

func (PermissionResources) ToSchemaPermissionResources

func (a PermissionResources) ToSchemaPermissionResources() []*schema.PermissionResource

ToSchemaPermissionResources - Convert to permission resource list

type Permissions

type Permissions []*Permission

Permissions - Permission entity list

func (Permissions) ToSchemaPermissions

func (a Permissions) ToSchemaPermissions() []*schema.Permission

ToSchemaPermissions - Convert to permission object list

type Role

type Role struct {
	entity.Model
	UUID     string  `gorm:"column:record_id;size:36;index;"` // Record internal code
	Name     *string `gorm:"column:name;size:100;index;"`     // Role Name
	Sequence *int    `gorm:"column:sequence;index;"`          // Sort value
	Memo     *string `gorm:"column:memo;size:200;"`           // Remarks
	Creator  *string `gorm:"column:creator;size:36;"`         // Creator
}

Role - Role entity

func (Role) String

func (a Role) String() string

func (Role) TableName

func (a Role) TableName() string

TableName - Table Name

func (Role) ToSchemaRole

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

ToSchemaRole - Convert to a role object

type RolePermission

type RolePermission struct {
	entity.Model
	RoleID       string  `gorm:"column:role_id;size:36;index;"`       // Role inner code
	PermissionID string  `gorm:"column:permission_id;size:36;index;"` // Permission internal code
	Action       *string `gorm:"column:action;size:2048;"`            // Action permissions (multiple separated by commas)
	Resource     *string `gorm:"column:resource;size:2048;"`          // Resource permissions (multiple separated by commas)
}

RolePermission - Role permission associated entity

func (RolePermission) TableName

func (a RolePermission) TableName() string

TableName - Table Name

func (RolePermission) ToSchemaRolePermission

func (a RolePermission) ToSchemaRolePermission() *schema.RolePermission

ToSchemaRolePermission - Convert to a role permission object

type RolePermissions

type RolePermissions []*RolePermission

RolePermissions - Role permission associated entity list

func (RolePermissions) GetByRoleID

func (a RolePermissions) GetByRoleID(roleID string) []*schema.RolePermission

GetByRoleID - Get a list of role permission objects based on the role ID

func (RolePermissions) ToMap

func (a RolePermissions) ToMap() map[string]*RolePermission

ToMap - Convert to key-value mapping

func (RolePermissions) ToSchemaRolePermissions

func (a RolePermissions) ToSchemaRolePermissions() []*schema.RolePermission

ToSchemaRolePermissions - Convert to a list of role permission objects

type Roles

type Roles []*Role

Roles - List of role entities

func (Roles) ToSchemaRoles

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

ToSchemaRoles - Convert to a list of role objects

type SchemaPermission

type SchemaPermission schema.Permission

SchemaPermission - Permission object

func (SchemaPermission) ToPermission

func (a SchemaPermission) ToPermission() *Permission

ToPermission - Convert to permission entity

func (SchemaPermission) ToPermissionActions

func (a SchemaPermission) ToPermissionActions() []*PermissionAction

ToPermissionActions - Convert to permission action list

func (SchemaPermission) ToPermissionResources

func (a SchemaPermission) ToPermissionResources() []*PermissionResource

ToPermissionResources - Convert to permission resource list

type SchemaPermissionAction

type SchemaPermissionAction schema.PermissionAction

SchemaPermissionAction Permission action object

func (SchemaPermissionAction) ToPermissionAction

func (a SchemaPermissionAction) ToPermissionAction(permissionID string) *PermissionAction

ToPermissionAction - Convert to permission action entity

type SchemaPermissionResource

type SchemaPermissionResource schema.PermissionResource

SchemaPermissionResource - Permission resource object

func (SchemaPermissionResource) ToPermissionResource

func (a SchemaPermissionResource) ToPermissionResource(permissionID string) *PermissionResource

ToPermissionResource - Convert to permission resource entity

type SchemaRole

type SchemaRole schema.Role

SchemaRole - Role object

func (SchemaRole) ToRole

func (a SchemaRole) ToRole() *Role

ToRole - Convert to a role entity

func (SchemaRole) ToRolePermissions

func (a SchemaRole) ToRolePermissions() []*RolePermission

ToRolePermissions - Convert to role permission entity list

type SchemaRolePermission

type SchemaRolePermission schema.RolePermission

SchemaRolePermission - Role permission object

func (SchemaRolePermission) ToRolePermission

func (a SchemaRolePermission) ToRolePermission(roleID string) *RolePermission

ToRolePermission - Convert to role permission entity

type SchemaUser

type SchemaUser schema.User

SchemaUser - User object

func (SchemaUser) ToUser

func (a SchemaUser) ToUser() *User

ToUser - Convert to user entity

func (SchemaUser) ToUserRoles

func (a SchemaUser) ToUserRoles() []*UserRole

ToUserRoles - Convert to user role association list

type User

type User struct {
	entity.Model
	UUID     string  `gorm:"column:record_id;size:36;index;"` // Record internal code
	UserName *string `gorm:"column:user_name;size:64;index;"` // UserName
	RealName *string `gorm:"column:real_name;size:64;index;"` // RealName
	Password *string `gorm:"column:password;size:40;"`        // Password (sha1 (md5 (plain text)) encryption)
	Email    *string `gorm:"column:email;not null;unique"`    // Email
	Phone    *string `gorm:"column:phone;size:20;index;"`     // Phone
	Status   *int    `gorm:"column:status;index;"`            // Status (1: Enable 2: Disable)
	Creator  *string `gorm:"column:creator;size:36;"`         // Creator
}

User - User entity

func (User) String

func (a User) String() string

func (User) TableName

func (a User) TableName() string

TableName - Table Name

func (User) ToSchemaUser

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

ToSchemaUser - Convert to user object

type UserRole

type UserRole struct {
	entity.Model
	UserUUID string `gorm:"column:user_uuid;size:36;index;"` // User ID
	RoleID   string `gorm:"column:role_id;size:36;index;"`   // Role ID
}

UserRole - User role association entity

func (UserRole) TableName

func (a UserRole) TableName() string

TableName - Table Name

func (UserRole) ToSchemaUserRole

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

ToSchemaUserRole - Convert to user role object

type UserRoles

type UserRoles []*UserRole

UserRoles - User role association list

func (UserRoles) GetByUserUUID

func (a UserRoles) GetByUserUUID(userUUID string) []*schema.UserRole

GetByUserUUID - Get the list of user role objects based on the user ID

func (UserRoles) ToSchemaUserRoles

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

ToSchemaUserRoles - Convert to a list of user role objects

type Users

type Users []*User

Users - User entity list

func (Users) ToSchemaUsers

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

ToSchemaUsers - Convert to user object list

Jump to

Keyboard shortcuts

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