package models type StatEntry struct { ID int `json:"id"` Name string `json:"name"` Weight float64 `json:"weight"` } type StatProgressEntry struct { StatEntry Acquired int `json:"acquired"` Required int `json:"required"` } type Stat struct { StatEntry Description string `json:"description"` AllowedAmounts map[string]int `json:"allowedAmounts"` } func (stat *Stat) AllowsAmount(amount int) bool { if stat == nil { return false } if stat.AllowedAmounts == nil || len(stat.AllowedAmounts) == 0 { return true } for _, v := range stat.AllowedAmounts { if v == amount { return true } } return false }