-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
food.go
177 lines (144 loc) · 4.99 KB
/
food.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
package gofakeit
import (
"strings"
)
// Fruit will return a random fruit name
func Fruit() string { return fruit(GlobalFaker) }
// Fruit will return a random fruit name
func (f *Faker) Fruit() string { return fruit(f) }
func fruit(f *Faker) string { return getRandValue(f, []string{"food", "fruit"}) }
// Vegetable will return a random vegetable name
func Vegetable() string { return vegetable(GlobalFaker) }
// Vegetable will return a random vegetable name
func (f *Faker) Vegetable() string { return vegetable(f) }
func vegetable(f *Faker) string { return getRandValue(f, []string{"food", "vegetable"}) }
// Breakfast will return a random breakfast name
func Breakfast() string { return breakfast(GlobalFaker) }
// Breakfast will return a random breakfast name
func (f *Faker) Breakfast() string { return breakfast(f) }
func breakfast(f *Faker) string {
v := getRandValue(f, []string{"food", "breakfast"})
return strings.ToUpper(v[:1]) + v[1:]
}
// Lunch will return a random lunch name
func Lunch() string { return lunch(GlobalFaker) }
// Lunch will return a random lunch name
func (f *Faker) Lunch() string { return lunch(f) }
func lunch(f *Faker) string {
v := getRandValue(f, []string{"food", "lunch"})
return strings.ToUpper(v[:1]) + v[1:]
}
// Dinner will return a random dinner name
func Dinner() string { return dinner(GlobalFaker) }
// Dinner will return a random dinner name
func (f *Faker) Dinner() string { return dinner(f) }
func dinner(f *Faker) string {
v := getRandValue(f, []string{"food", "dinner"})
return strings.ToUpper(v[:1]) + v[1:]
}
// Drink will return a random drink name
func Drink() string { return drink(GlobalFaker) }
// Drink will return a random drink name
func (f *Faker) Drink() string { return drink(f) }
func drink(f *Faker) string {
v := getRandValue(f, []string{"food", "drink"})
return strings.ToUpper(v[:1]) + v[1:]
}
// Snack will return a random snack name
func Snack() string { return snack(GlobalFaker) }
// Snack will return a random snack name
func (f *Faker) Snack() string { return snack(f) }
func snack(f *Faker) string {
v := getRandValue(f, []string{"food", "snack"})
return strings.ToUpper(v[:1]) + v[1:]
}
// Dessert will return a random dessert name
func Dessert() string { return dessert(GlobalFaker) }
// Dessert will return a random dessert name
func (f *Faker) Dessert() string { return dessert(f) }
func dessert(f *Faker) string {
v := getRandValue(f, []string{"food", "dessert"})
return strings.ToUpper(v[:1]) + v[1:]
}
func addFoodLookup() {
AddFuncLookup("fruit", Info{
Display: "Fruit",
Category: "food",
Description: "Edible plant part, typically sweet, enjoyed as a natural snack or dessert",
Example: "Peach",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return fruit(f), nil
},
})
AddFuncLookup("vegetable", Info{
Display: "Vegetable",
Category: "food",
Description: "Edible plant or part of a plant, often used in savory cooking or salads",
Example: "Amaranth Leaves",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return vegetable(f), nil
},
})
AddFuncLookup("breakfast", Info{
Display: "Breakfast",
Category: "food",
Description: "First meal of the day, typically eaten in the morning",
Example: "Blueberry banana happy face pancakes",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return breakfast(f), nil
},
})
AddFuncLookup("lunch", Info{
Display: "Lunch",
Category: "food",
Description: "Midday meal, often lighter than dinner, eaten around noon",
Example: "No bake hersheys bar pie",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return lunch(f), nil
},
})
AddFuncLookup("dinner", Info{
Display: "Dinner",
Category: "food",
Description: "Evening meal, typically the day's main and most substantial meal",
Example: "Wild addicting dip",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return dinner(f), nil
},
})
AddFuncLookup("drink", Info{
Display: "Drink",
Category: "food",
Description: "Liquid consumed for hydration, pleasure, or nutritional benefits",
Example: "Soda",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return drink(f), nil
},
})
AddFuncLookup("snack", Info{
Display: "Snack",
Category: "food",
Description: "Random snack",
Example: "Small, quick food item eaten between meals",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return snack(f), nil
},
})
AddFuncLookup("dessert", Info{
Display: "Dessert",
Category: "food",
Description: "Sweet treat often enjoyed after a meal",
Example: "French napoleons",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return dessert(f), nil
},
})
}