categories

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package categories provides category management.

As per the long pondering, this is how categories (cats for short) work in Mycorrhiza:

  • Cats are not hyphae. Cats are separate entities. This is not as vibeful as I would have wanted, but seems to be more practical due to //the reasons//.
  • Cats are stored outside of git. Instead, they are stored in a JSON file, path to which is determined by files.CategoriesJSON.
  • Due to not being stored in git, no cat history is tracked, and cat operations are not mentioned on the recent changes page.
  • For cat A, if there are 0 hyphae in the cat, cat A does not exist. If there are 1 or more hyphae in the cat, cat A exists.

List of things to do with categories later:

  • Forbid / in cat names.
  • Rename categories.
  • Delete categories.
  • Bind hyphae.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHyphaToCategory added in v1.11.0

func AddHyphaToCategory(hyphaName, catName string)

AddHyphaToCategory adds the hypha to the category and updates the records on the disk. If the hypha is already in the category, nothing happens. Pass canonical names.

func CategoriesWithHypha added in v1.12.0

func CategoriesWithHypha(hyphaName string) (categoryList []string)

CategoriesWithHypha returns what categories have the given hypha. The hypha name must be canonical.

func CategoryCard

func CategoryCard(meta viewutil.Meta, hyphaName string) string

CategoryCard is the little sidebar that is shown nearby the hypha view.

func Init

func Init()

Init initializes the category system. Call it after the Structure is initialized. This function might terminate the program in case of a bad mood or filesystem faults.

func InitHandlers

func InitHandlers(r *mux.Router)

InitHandlers initializes HTTP handlers for the given router. Call somewhere in package web.

func RemoveHyphaFromAllCategories added in v1.13.0

func RemoveHyphaFromAllCategories(hyphaName string)

RemoveHyphaFromAllCategories removes the given hypha from all the categories.

func RenameHyphaInAllCategories added in v1.11.0

func RenameHyphaInAllCategories(oldName, newName string)

RenameHyphaInAllCategories finds all mentions of oldName and replaces them with newName. Pass canonical names. Make sure newName is not taken. If oldName is not in any category, RenameHyphaInAllCategories is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

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