v0.0.1 Latest Latest

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

Go to latest
Published: Dec 2, 2020 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Category

type Category struct {
	PidField, IDField string
	// contains filtered or unexported fields

Category classification

func New

func New(options ...Option) *Category

New classification

func (*Category) Table

func (category *Category) Table(table database.Table) *Table

Table get the table structure do not pass a pointer

type Node

type Node struct {
	Alias       string `json:"alias"`       // It may be the data needed for page link splicing, such as items?category={alias} or items/{alias}
	Name        string `json:"name"`        // category display name
	Pic         string `json:"pic"`         // icon
	Badge       string `json:"badge"`       // badges, possible corner markers
	Description string `json:"description"` // possible introduction
	Next        Nodes  `json:"next"`        // subcategory

Node classification information

type Nodes

type Nodes []*Node

Nodes specify a level of classification information

type Option

type Option func(category *Category)

Option setup

func SetAliasField

func SetAliasField(field string) Option

SetAliasField set alias field field name

func SetBadgeField

func SetBadgeField(field string) Option

SetBadgeField set corner badge field name

func SetDescriptionField

func SetDescriptionField(field string) Option

SetDescriptionField set the field name of the detail profile

func SetIDField

func SetIDField(field string) Option

SetIDField set id field name

func SetLevelField

func SetLevelField(field string) Option

SetLevelField set hierarchical field name

func SetNameField

func SetNameField(field string) Option

SetNameField set display name field name

func SetPicField

func SetPicField(field string) Option

SetPicField set icon field name

func SetPidField

func SetPidField(field string) Option

SetPidField set parent identity field name

type Table

type Table struct {
	// contains filtered or unexported fields

Table orm table handler

func (*Table) WithDB

func (table *Table) WithDB(db *gorm.DB) *Tree

WithDB use gorm

type Tree

type Tree struct {
	// contains filtered or unexported fields

Tree all classified raw data (sorted)

func (*Tree) Categories

func (tree *Tree) Categories() Nodes

Categories get tree

Jump to

Keyboard shortcuts

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