aboutsummaryrefslogtreecommitdiffstats
path: root/mass
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2022-05-27 22:39:03 -0230
committerSam Anthony <sam@samanthony.xyz>2022-05-27 22:39:03 -0230
commit31605150d3e10b08dad2086005c64664f5648a51 (patch)
tree7419f90e7b30d3de52595f25852e9ef87094718c /mass
parent585fbf852c1e76470df42ebe99ede62440ce19d9 (diff)
downloadvolute-31605150d3e10b08dad2086005c64664f5648a51.zip
prepare to switch ui library
Diffstat (limited to 'mass')
-rw-r--r--mass/mass.go21
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))