diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-01-22 17:35:45 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-01-22 17:35:45 -0500 |
| commit | 2a14395beedc4b3cef74dd7d8b44f14bb8a7ac79 (patch) | |
| tree | 4216df7bc1ae2404c3fef879987eab50bbe89260 /mass | |
| parent | 4f6384f449b50a95255837b1fc394b4ebe14caaf (diff) | |
| parent | 9ad538983290fbd62da7f8d6db5a6dfe123a25c3 (diff) | |
| download | volute-2a14395beedc4b3cef74dd7d8b44f14bb8a7ac79.zip | |
merge backend refactoring from main
Diffstat (limited to 'mass')
| -rw-r--r-- | mass/mass.go | 47 |
1 files changed, 0 insertions, 47 deletions
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)) - } -} |