package counter import "fmt" func urlFor(who, what, dir string) string { return fmt.Sprintf("/counter/users/%s/items/%s/%s", who, what, dir) } func (p *CounterPlugin) allItems() map[string][]Item { items, err := GetAllItemsByUser(p.db) if err != nil { return map[string][]Item{"error": []Item{}} } return items } templ (p *CounterPlugin) index() {
for user, items := range p.allItems() {
{ user }:
for _, thing := range items { @p.renderItem(user, thing) }
}
} templ (p *CounterPlugin) renderItem(user string, item Item) {
{ item.Item }
{ fmt.Sprintf("%d", item.Count) }
}