diff options
Diffstat (limited to 'mass')
| -rw-r--r-- | mass/mass.go | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/mass/mass.go b/mass/mass.go index 46ce33e..c66e94d 100644 --- a/mass/mass.go +++ b/mass/mass.go @@ -16,30 +16,17 @@ const ( type FlowRate float32 const ( - KilogramsPerSecond FlowRate = 1 - PoundsPerMinute FlowRate = 0.007_559_872_833 -) - -// FlowRateUnitStrings returns a slice of strings, each representing a -// flowRate unit. -// This is necessary because giu.Combo only works with strings. -func FlowRateUnitStrings() []string { - return []string{"kg/s", "lb/min"} -} - -const ( - DefaultFlowRateUnit FlowRate = KilogramsPerSecond - // DefaultFlowRateUnitIndex is used to index FlowRateUnitStrings() - DefaultFlowRateUnitIndex int32 = 0 // kg/s + KilogramPerSecond FlowRate = 1 + PoundPerMinute FlowRate = 0.007_559_872_833 ) func FlowRateUnitFromString(s string) (FlowRate, error) { // Each case corresponds to a value in FlowRateUnitStrings(). switch s { case "kg/s": - return KilogramsPerSecond, nil + return KilogramPerSecond, nil case "lb/min": - return PoundsPerMinute, nil + return PoundPerMinute, nil default: return *new(FlowRate), errors.New( fmt.Sprintf("invalid mass flow rate unit: '%s'", s)) |