perm

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const TableName = "permissions"

Variables

This section is empty.

Functions

func ActScope

func ActScope(act string) func(db *gorm.DB) *gorm.DB

ActScope 根据 act 查询 - act 名称

func CheckNameAndAct

func CheckNameAndAct(scopes ...func(db *gorm.DB) *gorm.DB) bool

CheckNameAndAct 检测权限是否存在

func CreatePerm

func CreatePerm(ctx iris.Context)

CreatePerm 添加

func CreatenInBatches

func CreatenInBatches(db *gorm.DB, perms PermCollection) error

CreatenInBatches 批量加入

func DeletePerm

func DeletePerm(ctx iris.Context)

DeletePerm 删除

func First

func First(ctx iris.Context)

First 详情

func GetAll

func GetAll(ctx iris.Context)

GetAll 分页列表 - 获取分页参数 - 请求分页数据

func GetMigration

func GetMigration() *gormigrate.Migration

func GetPermsForRole

func GetPermsForRole() ([][]string, error)

GetPermsForRole

func NameScope

func NameScope(name string) func(db *gorm.DB) *gorm.DB

NameScope 根据 name 查询 - name 名称

func New

func New(routes []map[string]string) *source

func Party

func Party() func(index iris.Party)

Party 权限模块 - 定义模型 struct - 定义请求 struct - 定义响应 struct - 定义 module - 实现控制器逻辑

func UpdatePerm

func UpdatePerm(ctx iris.Context)

UpdatePerm 更新

Types

type BasePermission

type BasePermission struct {
	Name        string `gorm:"index:perm_index,unique;not null ;type:varchar(256)" json:"name" validate:"required,gte=4,lte=50"`
	Act         string `gorm:"index:perm_index;type:varchar(256)" json:"act" validate:"required"`
	DisplayName string `gorm:"type:varchar(256)" json:"displayName"`
	Description string `gorm:"type:varchar(256)" json:"description"`
}

BasePermission 权鉴基础模块

type PageResponse

type PageResponse struct {
	Item []*Response
}

Paginate 分页

func (*PageResponse) Find

func (res *PageResponse) Find(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error

func (*PageResponse) Paginate

func (res *PageResponse) Paginate(db *gorm.DB, pageScope func(db *gorm.DB) *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) (int64, error)

type PermCollection

type PermCollection []Permission

type Permission

type Permission struct {
	gorm.Model
	BasePermission
}

Permission 权鉴模块

func (*Permission) Create

func (item *Permission) Create(db *gorm.DB) (uint, error)

Create 添加

func (*Permission) Delete

func (item *Permission) Delete(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error

Delete 删除

func (*Permission) Update

func (item *Permission) Update(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error

Update 更新

type Request

type Request struct {
	BasePermission
}

Request 请求参数

func (*Request) Request

func (req *Request) Request(ctx iris.Context) error

type Response

type Response struct {
	orm.Model
	BasePermission
}

First 详情

func (*Response) First

func (res *Response) First(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error

Jump to

Keyboard shortcuts

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