category

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCategoryData

type CreateCategoryData struct {
	Pid   int64  // 父类ID
	Name  string // 分类名称
	Icon  string // 图标库 https://lineicons.com/icons/
	Level int64
}

type SearchData

type SearchData struct {
	Pid int32 // 父类ID
}

type Service

type Service interface {
	List(ctx core.Context) (categories []*model.Category, err error)
	Tree(ctx core.Context) (nodes []*TreeNode, err error)
	Create(ctx core.Context, siteData *CreateCategoryData) (err error)
	Modify(ctx core.Context, id int64, updateCategory *UpdateCategory) (err error)
	Delete(ctx core.Context, id int64) error
	Detail(ctx core.Context, id int64) (category *model.Category, err error)
	UpdateUsed(ctx core.Context, id, used int64) (err error)
	UpdateSort(ctx core.Context, id, sort int64) (err error)
	// contains filtered or unexported methods
}

func New

func New(db mysql.Repo, cache redis.Repo) Service

type TreeNode

type TreeNode struct {
	// Id 节点ID
	Id int64
	// Pid 父节点ID
	Pid int64
	// Name 节点名称
	Name string
	// Icon 图标
	Icon string
	// Child 获取子节点切片
	Child []*TreeNode
}

type UpdateCategory added in v1.1.0

type UpdateCategory struct {
	Name string `json:"name"` // 菜单名称
	Icon string `json:"icon"` // 图标
}

Jump to

Keyboard shortcuts

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