categories

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: AGPL-3.0 Imports: 8 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

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

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

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

func HyphaeInCategory

func HyphaeInCategory(catName string) (hyphaList []string)

HyphaeInCategory returns what hyphae are in the category. If the returned slice is empty, the category does not exist, and vice versa. The category name must be canonical.

func Init

func Init() error

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 ListOfCategories

func ListOfCategories() (categoryList []string)

ListOfCategories returns unsorted names of all categories.

func RemoveHyphaFromAllCategories

func RemoveHyphaFromAllCategories(hyphaName string)

RemoveHyphaFromAllCategories removes the given hypha from all the categories.

func RemoveHyphaFromCategory

func RemoveHyphaFromCategory(hyphaName, catName string)

RemoveHyphaFromCategory removes the hypha from the category and updates the records on the disk. If the hypha is not in the category, nothing happens. Pass canonical names.

func RenameHyphaInAllCategories

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