-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathequipment.go
81 lines (71 loc) · 3.29 KB
/
equipment.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
// Code generated by jsonschema. DO NOT EDIT.
package beerjson
import "encoding/json"
import "fmt"
// ID: https://raw.githubusercontent.com/beerjson/beerjson/master/json/equipment.json
// The descriptive base type for brew day equipment. Provides unique properties to fully describe the recipe.
type EquipmentBase struct {
Name string `json:"name", validate:"required"`
KeyType *string `json:"type,omitempty"`
EquipmentBaseForm EquipmentBaseForm `json:"form", validate:"required"`
MaximumVolume VolumeType `json:"maximum_volume", validate:"required"`
}
type EquipmentBaseForm string
func (s *EquipmentBaseForm) UnmarshalJSON(b []byte) error {
var v string
err := json.Unmarshal(b, &v)
if err != nil {
return err
}
*s = EquipmentBaseForm(v)
switch *s {
case EquipmentBaseForm_HLT:
return nil
case EquipmentBaseForm_MashTun:
return nil
case EquipmentBaseForm_LauterTun:
return nil
case EquipmentBaseForm_BrewKettle:
return nil
case EquipmentBaseForm_Fermenter:
return nil
case EquipmentBaseForm_AgingVessel:
return nil
case EquipmentBaseForm_PackagingVessel:
return nil
}
return fmt.Errorf("EquipmentBaseForm: value '%v' does not match any value", v)
}
const (
EquipmentBaseForm_HLT EquipmentBaseForm = "HLT"
EquipmentBaseForm_MashTun EquipmentBaseForm = "Mash Tun"
EquipmentBaseForm_LauterTun EquipmentBaseForm = "Lauter Tun"
EquipmentBaseForm_BrewKettle EquipmentBaseForm = "Brew Kettle"
EquipmentBaseForm_Fermenter EquipmentBaseForm = "Fermenter"
EquipmentBaseForm_AgingVessel EquipmentBaseForm = "Aging Vessel"
EquipmentBaseForm_PackagingVessel EquipmentBaseForm = "Packaging Vessel"
)
// EquipmentType provides necessary information for individual brewing equipment.
type EquipmentItemType struct {
Name *string `json:"name,omitempty"`
KeyType *string `json:"type,omitempty"`
MaximumVolume *VolumeType `json:"maximum_volume,omitempty"`
Loss VolumeType `json:"loss", validate:"required"`
// The volume boiled off during 1 hour, measured before and after at room temperature.
BoilRatePerHour *VolumeType `json:"boil_rate_per_hour,omitempty"`
// The volume that leaves the kettle, especially important for non-immersion chillers that cool the wort as it leaves the kettle.
DrainRatePerMinute *VolumeType `json:"drain_rate_per_minute,omitempty"`
EquipmentBaseForm *EquipmentBaseForm `json:"form,omitempty"`
// The weight of the piece of equipment, especially important for when the mashtun is not preheated.
Weight *MassType `json:"weight,omitempty"`
// The specific heat of the piece of equipment, expressed in Cal/(g*C), especially important for when the mashtun is not preheated.
SpecificHeat *SpecificHeatType `json:"specific_heat,omitempty"`
Notes *string `json:"notes,omitempty"`
// The apparent volume absorbed by grain, typical values are 0.125 qt/lb (1.04 L/kg) for a mashtun, 0.08 gal/lb (0.66 L/kg) for BIAB.
GrainAbsorptionRate *SpecificVolumeType `json:"grain_absorption_rate,omitempty"`
}
// Provides necessary information for brewing equipment set.
type EquipmentType struct {
Name string `json:"name", validate:"required"`
EquipmentItems []EquipmentItemType `json:"equipment_items", validate:"required"`
}