role

package
v0.0.0-...-c8dbcfe Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RoleMenuSet = wire.NewSet(wire.Struct(new(RoleMenuRepo), "*"))
View Source
var RoleSet = wire.NewSet(wire.Struct(new(RoleRepo), "*"))

Functions

func GetRoleDB

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

func GetRoleMenuDB

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

Types

type Role

type Role struct {
	util.Model
	Name     string  `gorm:"size:100;index;default:'';not null;"` // 角色名称
	Sequence int     `gorm:"index;default:0;"`                    // 排序值
	Memo     *string `gorm:"size:1024;"`                          // 备注
	Status   int     `gorm:"index;"`                              // 状态(1:启用 0:禁用)
	Creator  uint64  `gorm:""`                                    // 创建者
	DomainID uint64  `gorm:"index;column:domain_id;"`             // domain id
}

func (Role) ToSchemaRole

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

type RoleMenu

type RoleMenu struct {
	util.Model
	RoleID   uint64 `gorm:"index;not null;"` // 角色ID
	MenuID   uint64 `gorm:"index;not null;"` // 菜单ID
	ActionID uint64 `gorm:"index;not null;"` // 动作ID
}

func (RoleMenu) ToSchemaRoleMenu

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

type RoleMenuRepo

type RoleMenuRepo struct {
	DB *gorm.DB
}

func (*RoleMenuRepo) Create

func (a *RoleMenuRepo) Create(ctx context.Context, item schema.RoleMenu) error

func (*RoleMenuRepo) Delete

func (a *RoleMenuRepo) Delete(ctx context.Context, id uint64) error

func (*RoleMenuRepo) DeleteByRoleID

func (a *RoleMenuRepo) DeleteByRoleID(ctx context.Context, roleID uint64) error

func (*RoleMenuRepo) DeleteByRoleIDs

func (a *RoleMenuRepo) DeleteByRoleIDs(ctx context.Context, roleIDs []uint64) error

func (*RoleMenuRepo) Get

func (*RoleMenuRepo) Query

func (*RoleMenuRepo) Update

func (a *RoleMenuRepo) Update(ctx context.Context, id uint64, item schema.RoleMenu) error

type RoleMenus

type RoleMenus []*RoleMenu

func (RoleMenus) ToSchemaRoleMenus

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

type RoleRepo

type RoleRepo struct {
	DB *gorm.DB
}

func (*RoleRepo) Create

func (a *RoleRepo) Create(ctx context.Context, item schema.Role) error

func (*RoleRepo) Delete

func (a *RoleRepo) Delete(ctx context.Context, id uint64) error

func (*RoleRepo) DeleteByDomainID

func (a *RoleRepo) DeleteByDomainID(ctx context.Context, domainID uint64) error

func (*RoleRepo) Get

func (a *RoleRepo) Get(ctx context.Context, id uint64, opts ...schema.RoleQueryOptions) (*schema.Role, error)

func (*RoleRepo) Query

func (*RoleRepo) Update

func (a *RoleRepo) Update(ctx context.Context, id uint64, item schema.Role) error

func (*RoleRepo) UpdateStatus

func (a *RoleRepo) UpdateStatus(ctx context.Context, id uint64, status int) error

type Roles

type Roles []*Role

func (Roles) ToSchemaRoles

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

type SchemaRole

type SchemaRole schema.Role

func (SchemaRole) ToRole

func (a SchemaRole) ToRole() *Role

type SchemaRoleMenu

type SchemaRoleMenu schema.RoleMenu

func (SchemaRoleMenu) ToRoleMenu

func (a SchemaRoleMenu) ToRoleMenu() *RoleMenu

Jump to

Keyboard shortcuts

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