-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfermentable.go
277 lines (242 loc) · 11.4 KB
/
fermentable.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
// Code generated by jsonschema. DO NOT EDIT.
package beerjson
import "encoding/json"
import "fmt"
// ID: https://raw.githubusercontent.com/beerjson/beerjson/master/json/fermentable.json
// FermentableAdditionType collects the attributes of each fermentable ingredient for use in a recipe fermentable bill.
type FermentableAdditionType struct {
Producer *string `json:"producer,omitempty"`
Color *ColorType `json:"color,omitempty"`
Name *string `json:"name,omitempty"`
Origin *string `json:"origin,omitempty"`
// The timing object fully describes the timing of an addition with options for basis on time, gravity, or pH at any process step.
Timing *TimingType `json:"timing,omitempty"`
Amount FermentableAdditionTypeAmount `json:"amount", validate:"required,oneof"`
ProductId *string `json:"product_id,omitempty"`
FermentableBaseGrainGroup *FermentableBaseGrainGroup `json:"grain_group,omitempty"`
Yield *YieldType `json:"yield,omitempty"`
FermentableBaseType *FermentableBaseType `json:"type,omitempty"`
}
func (s *FermentableAdditionType) UnmarshalJSON(b []byte) error {
m := map[string]json.RawMessage{}
if err := json.Unmarshal(b, &m); err != nil {
return nil
}
fermentableAdditionTypeAmount := func() FermentableAdditionTypeAmount {
raw, ok := m["amount"]
if !ok {
return nil
}
var volumeType VolumeType
if err := json.Unmarshal(raw, &volumeType); err == nil {
return &volumeType
}
var massType MassType
if err := json.Unmarshal(raw, &massType); err == nil {
return &massType
}
return nil
}
type Alias FermentableAdditionType
aux := &struct {
Amount FermentableAdditionTypeAmount `json:"amount", validate:"required,oneof"`
*Alias
}{
Amount: fermentableAdditionTypeAmount(),
Alias: (*Alias)(s),
}
if err := json.Unmarshal(b, &aux); err != nil {
return err
}
s.Amount = aux.Amount
return nil
}
// FermentableAdditionTypeAmount
type FermentableAdditionTypeAmount interface {
FermentableAdditionTypeamount()
}
// FermentableBase provides unique properties to identify individual records of fermentable ingredients.
type FermentableBase struct {
FermentableBaseType FermentableBaseType `json:"type", validate:"required"`
Origin *string `json:"origin,omitempty"`
Producer *string `json:"producer,omitempty"`
ProductId *string `json:"product_id,omitempty"`
FermentableBaseGrainGroup *FermentableBaseGrainGroup `json:"grain_group,omitempty"`
Yield YieldType `json:"yield", validate:"required"`
Color ColorType `json:"color", validate:"required"`
Name string `json:"name", validate:"required"`
}
type FermentableBaseGrainGroup string
func (s *FermentableBaseGrainGroup) UnmarshalJSON(b []byte) error {
var v string
err := json.Unmarshal(b, &v)
if err != nil {
return err
}
*s = FermentableBaseGrainGroup(v)
switch *s {
case FermentableBaseGrainGroup_Base:
return nil
case FermentableBaseGrainGroup_Caramel:
return nil
case FermentableBaseGrainGroup_Flaked:
return nil
case FermentableBaseGrainGroup_Roasted:
return nil
case FermentableBaseGrainGroup_Specialty:
return nil
case FermentableBaseGrainGroup_Smoked:
return nil
case FermentableBaseGrainGroup_Adjunct:
return nil
}
return fmt.Errorf("FermentableBaseGrainGroup: value '%v' does not match any value", v)
}
const (
FermentableBaseGrainGroup_Base FermentableBaseGrainGroup = "base"
FermentableBaseGrainGroup_Caramel FermentableBaseGrainGroup = "caramel"
FermentableBaseGrainGroup_Flaked FermentableBaseGrainGroup = "flaked"
FermentableBaseGrainGroup_Roasted FermentableBaseGrainGroup = "roasted"
FermentableBaseGrainGroup_Specialty FermentableBaseGrainGroup = "specialty"
FermentableBaseGrainGroup_Smoked FermentableBaseGrainGroup = "smoked"
FermentableBaseGrainGroup_Adjunct FermentableBaseGrainGroup = "adjunct"
)
type FermentableBaseType string
func (s *FermentableBaseType) UnmarshalJSON(b []byte) error {
var v string
err := json.Unmarshal(b, &v)
if err != nil {
return err
}
*s = FermentableBaseType(v)
switch *s {
case FermentableBaseType_DryExtract:
return nil
case FermentableBaseType_Extract:
return nil
case FermentableBaseType_Grain:
return nil
case FermentableBaseType_Sugar:
return nil
case FermentableBaseType_Fruit:
return nil
case FermentableBaseType_Juice:
return nil
case FermentableBaseType_Honey:
return nil
case FermentableBaseType_Other:
return nil
}
return fmt.Errorf("FermentableBaseType: value '%v' does not match any value", v)
}
const (
FermentableBaseType_DryExtract FermentableBaseType = "dry extract"
FermentableBaseType_Extract FermentableBaseType = "extract"
FermentableBaseType_Grain FermentableBaseType = "grain"
FermentableBaseType_Sugar FermentableBaseType = "sugar"
FermentableBaseType_Fruit FermentableBaseType = "fruit"
FermentableBaseType_Juice FermentableBaseType = "juice"
FermentableBaseType_Honey FermentableBaseType = "honey"
FermentableBaseType_Other FermentableBaseType = "other"
)
type FermentableInventoryType struct {
Amount FermentableInventoryTypeAmount `json:"amount,omitempty", validate:"oneof"`
}
func (s *FermentableInventoryType) UnmarshalJSON(b []byte) error {
m := map[string]json.RawMessage{}
if err := json.Unmarshal(b, &m); err != nil {
return nil
}
fermentableInventoryTypeAmount := func() FermentableInventoryTypeAmount {
raw, ok := m["amount"]
if !ok {
return nil
}
var volumeType VolumeType
if err := json.Unmarshal(raw, &volumeType); err == nil {
return &volumeType
}
var massType MassType
if err := json.Unmarshal(raw, &massType); err == nil {
return &massType
}
return nil
}
type Alias FermentableInventoryType
aux := &struct {
Amount FermentableInventoryTypeAmount `json:"amount,omitempty", validate:"oneof"`
*Alias
}{
Amount: fermentableInventoryTypeAmount(),
Alias: (*Alias)(s),
}
if err := json.Unmarshal(b, &aux); err != nil {
return err
}
s.Amount = aux.Amount
return nil
}
// FermentableInventoryTypeAmount
type FermentableInventoryTypeAmount interface {
FermentableInventoryTypeamount()
}
// FermentableType collects the attributes of a fermentable ingredient to store as record information.
type FermentableType struct {
// The percentage of protein. Higher values may indicate a possibility of haze, or lautering issues.
Protein *PercentType `json:"protein,omitempty"`
// True if the fermentable must be mashed, false if it can be steeped.
RecommendMash *bool `json:"recommend_mash,omitempty"`
Name *string `json:"name,omitempty"`
Origin *string `json:"origin,omitempty"`
Producer *string `json:"producer,omitempty"`
Moisture *PercentType `json:"moisture,omitempty"`
// The recommended maximum percentage to use in a grain bill.
MaxInBatch *PercentType `json:"max_in_batch,omitempty"`
Color *ColorType `json:"color,omitempty"`
// The Kolbach Index, also known as soluble to total ratio of nitrogen or protein, is used to indcate the degree of malt modification. A value above 35% is desired for simple single infusion mashing, undermodified malt may require multiple step mashes or decoction.
KolbachIndex *PercentType `json:"kolbach_index,omitempty"`
// Diastatic power is a measurement of malted grains enzymatic content. A value of 35 Lintner is needed to self convert, while a value of 100 or more is desirable.
DiastaticPower *DiastaticPowerType `json:"diastatic_power,omitempty"`
FermentableBaseType *FermentableBaseType `json:"type,omitempty"`
ProductId *string `json:"product_id,omitempty"`
FermentableBaseGrainGroup *FermentableBaseGrainGroup `json:"grain_group,omitempty"`
Yield *YieldType `json:"yield,omitempty"`
// Where diastatic power gives the total amount of all enzymes, alpha amylase, also known as dextrinizing units, refers to only the total amount of alpa amylase in the malted grain. A value of 25-50 is desirable for base malt.
AlphaAmylase *float64 `json:"alpha_amylase,omitempty"`
Inventory *FermentableInventoryType `json:"inventory,omitempty"`
Notes *string `json:"notes,omitempty"`
// Used to indicate the ‘crystallized’ percentage of starches for crystal malts.
Glassy *PercentType `json:"glassy,omitempty"`
// The percentage of grain that masses through sieves with gaps of 7/64 and 6/64, desired values of 80% or higher which indicate plump kernels.
Plump *PercentType `json:"plump,omitempty"`
Half *PercentType `json:"half,omitempty"`
// The opposite of glassy, a mealy kernel is one that is not glassy. Base malt should be at least 90%, single step mashes generally require 95% or higher.
Mealy *PercentType `json:"mealy,omitempty"`
// The Percentage of grain that makes it through a thin mesh screen, typically 5/64 inch. Values less than 3% are desired.
Thru *PercentType `json:"thru,omitempty"`
// Friability is the measure of a malts ability to crumble during the crush, and is used as an indicator for easy gelatinization of the grain and starches, as well as modification of the malt. Value of 85% of higher indicates a well modified malt and is suitable for single step mashes. Lower values may require a step mash.
Friability *PercentType `json:"friability,omitempty"`
// The pH of the resultant wort for 1 lb of grain mashed in 1 gallon of distilled water. Used in many water chemistry / mash pH prediction software.
DipH *AcidityType `json:"di_ph,omitempty"`
// The measure of wort viscosity, typically associated with the breakdown of beta-glucans. The higher the viscosity, the greater the need for a glucan rest and the less suitable for a fly sparge.
Viscosity *ViscosityType `json:"viscosity,omitempty"`
// The amount of DMS precursors, namely S-methyl methionine (SMM) and dimethyl sulfoxide (DMSO) in the malt which convert to dimethyl sulfide (DMS).
DMSP *ConcentrationType `json:"dms_p,omitempty"`
// Free Amino Nitrogen (FAN) is a critical yeast nutrient. Typical values for base malt is 170.
FAN *ConcentrationType `json:"fan,omitempty"`
// Fermentability - Used in Extracts to indicate a baseline typical apparent attenuation for a typical medium attenuation yeast.
Fermentability *PercentType `json:"fermentability,omitempty"`
// Values of 180 or more may suggest a glucan rest and avoiding fly sparging.
BetaGlucan *ConcentrationType `json:"beta_glucan,omitempty"`
}
// The potential yield of the fermentable ingredient, supporting SG, or percentage. eg 1.037 or 80% are valid yield types.
type YieldType struct {
// Percentage yield compared to succrose of a fine grind. eg 80%
FineGrind *PercentType `json:"fine_grind,omitempty"`
// Percentage yield compared to succrose of a coarse grind. eg 78%
CoarseGrind *PercentType `json:"coarse_grind,omitempty"`
// The difference between fine and coarse grind, a difference more than 2 percent can indicate a protein or step mash may be desirable. eg 2%.
FineCoarseDifference *PercentType `json:"fine_coarse_difference,omitempty"`
// The potential yield of the fermentable ingredient for 1 lb of grain mashed in 1 gallon of water. eg 1.037
Potential *GravityType `json:"potential,omitempty"`
}