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 ¶
- func AddHyphaToCategory(hyphaName, catName string)
- func CategoriesWithHypha(hyphaName string) (categoryList []string)
- func HyphaeInCategory(catName string) (hyphaList []string)
- func Init() error
- func ListOfCategories() (categoryList []string)
- func RemoveHyphaFromAllCategories(hyphaName string)
- func RemoveHyphaFromCategory(hyphaName, catName string)
- func RenameHyphaInAllCategories(oldName, newName string)
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 ¶
CategoriesWithHypha returns what categories have the given hypha. The hypha name must be canonical.
func HyphaeInCategory ¶
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.