-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.go
90 lines (80 loc) · 1.24 KB
/
entity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package beer
type Beer struct {
ID int64 `json:"id"`
Name string `json:"name"`
Type BeerType `json:"type"`
Style BeerStyle `json:"style"`
}
type BeerType int
const (
TypeAle = 1
TypeLager = 2
TypeMalt = 3
TypeStout = 4
)
func (t BeerType) String() string {
switch t {
case TypeAle:
return "Ale"
case TypeLager:
return "Lager"
case TypeMalt:
return "Malt"
case TypeStout:
return "Stout"
}
return "Unknown"
}
type BeerStyle int
const (
StyleAmber = iota + 1
StyleBlonde
StyleBrown
StyleCream
StyleDark
StylePale
StyleStrong
StyleWheat
StyleRed
StyleIPA
StyleLime
StylePilsner
StyleGolden
StyleFruit
StyleHoney
)
func (t BeerStyle) String() string {
switch t {
case StyleAmber:
return "Amber"
case StyleBlonde:
return "Blonde"
case StyleBrown:
return "Brown"
case StyleCream:
return "Cream"
case StyleDark:
return "Dark"
case StylePale:
return "Pale"
case StyleStrong:
return "Strong"
case StyleWheat:
return "Wheat"
case StyleRed:
return "Red"
case StyleIPA:
return "IPA"
case StyleLime:
return "Lime"
case StylePilsner:
return "Pilsner"
case StyleGolden:
return "Golden"
case StyleFruit:
return "Fruit"
case StyleHoney:
return "Honey"
}
return "Unknown"
}