From b6247a8372eb18a19c35a924316941d6c1e585d2 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sun, 15 Jan 2023 22:40:41 -0330 Subject: volume --- mass/mass.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 mass/mass.go (limited to 'mass/mass.go') diff --git a/mass/mass.go b/mass/mass.go deleted file mode 100644 index 46ce33e..0000000 --- a/mass/mass.go +++ /dev/null @@ -1,47 +0,0 @@ -package mass - -import ( - "errors" - "fmt" -) - -type Mass float32 - -const ( - Gram Mass = 1 - Kilogram Mass = 1_000 - Pound Mass = 453.5924 -) - -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 -) - -func FlowRateUnitFromString(s string) (FlowRate, error) { - // Each case corresponds to a value in FlowRateUnitStrings(). - switch s { - case "kg/s": - return KilogramsPerSecond, nil - case "lb/min": - return PoundsPerMinute, nil - default: - return *new(FlowRate), errors.New( - fmt.Sprintf("invalid mass flow rate unit: '%s'", s)) - } -} -- cgit v1.2.3