view

package
v0.0.0-...-2383c70 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "view"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMenuRequest

type CreateMenuRequest struct {
	// 服务
	Service string `json:"service" gorm:"column:service;type:varchar(100);index" bson:"service" description:"服务名称"`
	// 父Menu Id
	ParentId uint64 `json:"parent_id" bson:"parent_id" gorm:"column:parent_id;type:uint;index" description:"父Menu Id" optional:"true"`
	// 菜单路径
	Path string `json:"path" bson:"path" gorm:"column:path" description:"菜单路径" unique:"true"`
	// 菜单名称
	Name string `json:"name" bson:"name" gorm:"column:name" description:"菜单名称"`
	// 图标
	Icon string `json:"icon" bson:"icon" gorm:"column:icon" description:"图标" optional:"true"`
	// 标签
	Label string `json:"label" gorm:"column:label;type:varchar(200);index" description:"标签" optional:"true"`
	// 其他扩展信息
	Extras map[string]string `json:"extras" gorm:"column:extras;serializer:json;type:json" description:"其他扩展信息" optional:"true"`
}

func NewCreateMenuRequest

func NewCreateMenuRequest() *CreateMenuRequest

func (*CreateMenuRequest) Validate

func (r *CreateMenuRequest) Validate() error

type CreatePageRequest

type CreatePageRequest struct {
	// 菜单Id
	MenuId uint64 `json:"menu_id" bson:"menu_id" gorm:"column:menu_id;type:uint;index" description:"菜单Id"`
	// 页面路径
	Path string `json:"path" bson:"path" gorm:"column:path" description:"页面路径" unique:"true"`
	// 页面名称
	Name string `json:"name" bson:"name" gorm:"column:name" description:"页面名称"`
	// 标签
	Label string `json:"label" gorm:"column:label;type:varchar(200);index" description:"标签" optional:"true"`
	// 关联的Api接口
	RefEndpointId []uint64 `` /* 147-byte string literal not displayed */
	// 其他扩展信息
	Extras map[string]string `json:"extras" gorm:"column:extras;serializer:json;type:json" description:"其他扩展信息" optional:"true"`
}

func NewCreatePageRequest

func NewCreatePageRequest() *CreatePageRequest

func (*CreatePageRequest) Validate

func (r *CreatePageRequest) Validate() error

type DeleteMenuRequest

type DeleteMenuRequest struct {
	apps.GetRequest
}

func NewDeleteMenuRequest

func NewDeleteMenuRequest() *DeleteMenuRequest

type DeletePageRequest

type DeletePageRequest struct {
	apps.GetRequest
}

func NewDeletePageRequest

func NewDeletePageRequest() *DeletePageRequest

type DescribeMenuRequest

type DescribeMenuRequest struct {
	apps.GetRequest
}

func NewDescribeMenuRequest

func NewDescribeMenuRequest() *DescribeMenuRequest

type DescribePageRequest

type DescribePageRequest struct {
	apps.GetRequest
}

func NewDescribePageRequest

func NewDescribePageRequest() *DescribePageRequest
type Menu struct {
	// 基础数据
	apps.ResourceMeta
	// 菜单定义
	CreateMenuRequest
	// 用户是否有权限访问该菜单, 只有在策略模块查询时,才会计算出该字段
	HasPermission *bool `` /* 143-byte string literal not displayed */
	// 菜单关联的页面
	Pages []*Page `json:"pages,omitempty" gorm:"-" description:"菜单关联的页面"`
}

func NewMenu

func NewMenu() *Menu
func (m *Menu) SetHasPermission(v bool) *Menu
func (m *Menu) TableName() string
type MenuService interface {
	// 创建菜单
	CreateMenu(context.Context, *CreateMenuRequest) (*Menu, error)
	// 查询列表
	QueryMenu(context.Context, *QueryMenuRequest) (*types.Set[*Menu], error)
	// 查询详情
	DescribeMenu(context.Context, *DescribeMenuRequest) (*Menu, error)
	// 更新菜单
	UpdateMenu(context.Context, *UpdateMenuRequest) (*Menu, error)
	// 删除菜单
	DeleteMenu(context.Context, *DeleteMenuRequest) (*Menu, error)
}

type Page

type Page struct {
	// 基础数据
	apps.ResourceMeta
	// 菜单定义
	CreatePageRequest
	// 用户是否有权限访问该页面, 只有在策略模块查询时,才会计算出该字段
	HasPermission *bool `` /* 143-byte string literal not displayed */
}

func NewPage

func NewPage() *Page

func (*Page) TableName

func (p *Page) TableName() string

type PageService

type PageService interface {
	// 页面列表
	QueryPage(context.Context, *QueryPageRequest) (*types.Set[*Page], error)
	// 页面详情
	DescribePage(context.Context, *DescribePageRequest) (*Page, error)
	// 添加页面
	CreatePage(context.Context, *CreatePageRequest) (*Page, error)
	// 移除页面
	DeletePage(context.Context, *DeletePageRequest) (*Page, error)
	// 更新页面
	UpdatePage(context.Context, *UpdatePageRequest) (*Page, error)
}

type QueryMenuRequest

type QueryMenuRequest struct {
	*request.PageRequest
}

func NewQueryMenuRequest

func NewQueryMenuRequest() *QueryMenuRequest

type QueryPageRequest

type QueryPageRequest struct {
	*request.PageRequest
	// 菜单Id
	MenuId uint64 `json:"menu_id"`
}

func NewQueryPageRequest

func NewQueryPageRequest() *QueryPageRequest

type Service

type Service interface {
	// 菜单管理
	MenuService
	// 页面管理
	PageService
}

func GetService

func GetService() Service

type TYPE

type TYPE uint8
const (
	TYPE_MENU TYPE = iota
	TYPE_PAGE
)

type UpdateMenuRequest

type UpdateMenuRequest struct {
	apps.GetRequest
	CreateMenuRequest
}

type UpdatePageRequest

type UpdatePageRequest struct {
	apps.GetRequest
	CreatePageRequest
}

Directories

Path Synopsis
api
gin
impl

Jump to

Keyboard shortcuts

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