package orderstatus type Info struct { Label string Class string Step int } var statuses = map[string]Info{ "new": {Label: "Новый", Class: "status--new", Step: 1}, "confirmed": {Label: "Подтверждён", Class: "status--confirmed", Step: 2}, "processing": {Label: "В обработке", Class: "status--processing", Step: 3}, "shipped": {Label: "Отправлен", Class: "status--shipped", Step: 4}, "delivered": {Label: "Доставлен", Class: "status--delivered", Step: 5}, "cancelled": {Label: "Отменён", Class: "status--cancelled", Step: 0}, } var Timeline = []string{"new", "confirmed", "processing", "shipped", "delivered"} func Get(code string) Info { if s, ok := statuses[code]; ok { return s } return Info{Label: code, Class: "status--new", Step: 1} } func Label(code string) string { return Get(code).Label } func Class(code string) string { return Get(code).Class } func Step(code string) int { return Get(code).Step }