diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2022-05-27 22:39:03 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2022-05-27 22:39:03 -0230 |
| commit | 31605150d3e10b08dad2086005c64664f5648a51 (patch) | |
| tree | 7419f90e7b30d3de52595f25852e9ef87094718c /mass/mass.go | |
| parent | 585fbf852c1e76470df42ebe99ede62440ce19d9 (diff) | |
| download | volute-31605150d3e10b08dad2086005c64664f5648a51.zip | |
prepare to switch ui library
Diffstat (limited to 'mass/mass.go')
| -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)) |