Documentation
¶
Index ¶
- Constants
- type Component
- type CreateMenuRequest
- type CreatePageRequest
- type DeleteMenuRequest
- type DeletePageRequest
- type DescribeMenuRequest
- type DescribePageRequest
- type Menu
- type MenuService
- type Page
- type PageService
- type QueryMenuRequest
- type QueryPageRequest
- type Service
- type TYPE
- type UpdateMenuRequest
- type UpdatePageRequest
Constants ¶
View Source
const (
AppName = "view"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶ added in v0.0.5
type Component struct {
// 组件名称
Name string `json:"name" bson:"name" description:"组件名称"`
// 组件说明
Description string `json:"description" optional:"true" description:"组件说明"`
// 组件使用文档链接
RefDocURL string `json:"ref_doc_url" optional:"true" description:"组件使用文档链接"`
// 关联的Api接口
RefEndpointId []uint64 `json:"ref_endpoints" description:"该页面管理的Api接口关联的接口" optional:"true"`
// 其他扩展信息
Extras map[string]string `json:"extras" description:"其他扩展信息" optional:"true"`
}
组件
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"`
// 页面组件,比如按钮
Components []Component `json:"components" gorm:"column:components;type:json;serializer:json" description:"组件" optional:"true"`
// 其他扩展信息
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 ¶
type Menu struct {
// 基础数据
apps.ResourceMeta
// 菜单定义
CreateMenuRequest
// 用户是否有权限访问该菜单, 只有在策略模块查询时,才会计算出该字段
HasPermission *bool `` /* 143-byte string literal not displayed */
// 菜单关联的页面
Pages []*Page `json:"pages,omitempty" gorm:"-" description:"菜单关联的页面"`
}
func (*Menu) SetHasPermission ¶
type MenuService ¶
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 */
}
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 UpdateMenuRequest ¶
type UpdateMenuRequest struct {
apps.GetRequest
CreateMenuRequest
}
type UpdatePageRequest ¶
type UpdatePageRequest struct {
apps.GetRequest
CreatePageRequest
}
Click to show internal directories.
Click to hide internal directories.