categories

package
v0.0.0-...-b84af7b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Read  []string `bson:"read" json:"read"`
	Write []string `bson:"write" json:"write"`
}

ACL for categories.

type Categories

type Categories []Category

Categories list.

func MakeTree

func MakeTree(d deps) Categories

MakeTree returns categories tree.

func (Categories) CheckWrite

func (slice Categories) CheckWrite(fn func([]string) bool) Categories

CheckWrite permissions for categories tree.

func (Categories) Len

func (slice Categories) Len() int

func (Categories) Less

func (slice Categories) Less(i, j int) bool

func (Categories) Swap

func (slice Categories) Swap(i, j int)

type Category

type Category struct {
	ID          bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Name        string        `bson:"name" json:"name"`
	Description string        `bson:"description" json:"description"`
	Slug        string        `bson:"slug" json:"slug"`
	Color       string        `bson:"color" json:"color"`
	Permissions ACL           `bson:"permissions" json:"-"`
	Parent      bson.ObjectId `bson:"parent,omitempty" json:"parent,omitempty"`
	ReactSet    []string      `bson:"reactSet" json:"-"`
	Order       int           `bson:"order,omitempty" json:"order,omitempty"`

	// Runtime computed properties.
	Child     Categories `bson:"-" json:"subcategories,omitempty"`
	Writable  bool       `bson:"-" json:"writable"`
	Reactions []string   `bson:"-" json:"reactions,omitempty"`
}

Category model.

Jump to

Keyboard shortcuts

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