Packages
Search packages... ⌘K
Go Package
catalogue
Hierarchical catalogue — nested category trees with path-based lookup
Go Ready MD
Tree Traversal go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
cat := catalogue.Build(propertyTypes.Entries)
// Path-based lookup: "residential/apartment"
node, ok := cat.Lookup("residential/apartment")
// node.Label == "Apartment", node.Depth == 2
// Walk the tree for navigation rendering
cat.Walk(func(node *catalogue.Node, depth int) bool {
indent := strings.Repeat(" ", depth)
fmt.Printf("%s%s (%d children)\n", indent, node.Label, len(node.Children))
return true // continue traversal
})
// residential (3 children)
// apartment (0 children)
// house (2 children)
// townhouse (0 children)
// detached (0 children)About
Builds and queries hierarchical category trees from dictionary entries. Supports materialized path lookups, depth-limited traversal, and efficient subtree extraction for navigation and filtering use cases.
Public API
| Name | Kind | Signature |
|---|---|---|
| Catalogue | type | type Catalogue struct |
| Node | type | type Node struct |
| Build | func | func Build(entries []dictionary.Entry) *Catalogue |
| Lookup | func | func (c *Catalogue) Lookup(path string) (*Node, bool) |
| Walk | func | func (c *Catalogue) Walk(fn func(node *Node, depth int) bool) |
Source
github.com/shredbx/sbx-core/pkg/catalogue
hierarchytree-structurecategoriespath-lookup