func ApplyFilters
1func ApplyFilters(u *url.URL, items *bptree.BPTree, paramName string) (string, *bptree.BPTree)ApplyFilters filters items based on the "filter" query parameter in the given URL and generates a Markdown representation of all available filters.
Expected `items` structure:
- `items` is an *bptree.BPTree where each key is a filter name (e.g., "T1", "size:XL", "on_sale") and each value is an *bptree.BPTree containing the items for that filter.
- Each item tree uses: Key (string): Unique item identifier Value (any) : Optional associated item data
Example:
Example
1// Build the main filters tree
2filters := bptree.NewBPTree32()
3
4// Subtree for filter "T1"
5t1Items := bptree.NewBPTree32()
6t1Items.Set("item1", nil)
7t1Items.Set("item2", nil)
8filters.Set("T1", t1Items)
9
10// URL with active filter "T1"
11u, _ := url.Parse("/shop?filter=T1")
12
13mdFilters, items := ApplyFilters(u, filters, "filter")
14
15// mdFilters → Markdown links for toggling filters
16// items → AVL tree containing the filtered items