diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2022-02-01 10:57:27 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2022-02-01 10:57:27 +0100 |
commit | e9afb0fdeb25eb760e2af17bfd5b904845955c2c (patch) | |
tree | de5a740dd54ea701158c3599d2c51dbce1d74d68 /types.go | |
parent | cb105e76493c5459f6786987ad40482b4e9698c7 (diff) | |
download | engarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.tar.gz engarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.tar.bz2 engarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.zip |
Combo Boxes
Diffstat (limited to 'types.go')
-rw-r--r-- | types.go | 33 |
1 files changed, 13 insertions, 20 deletions
@@ -51,22 +51,17 @@ func (g *Gender) UnmarshalCSV(content []byte) error { } } -type AgeGroup int +type AgeGroup int32 const ( AgeVeteran AgeGroup = iota AgeSenior ) +var AgeGroupStrings = []string{"Veteranen", "Senioren"} + func (a AgeGroup) String() string { - switch a { - case AgeVeteran: - return "V" - case AgeSenior: - return "S" - default: - return fmt.Sprintf("U%d", a) - } + return AgeGroupStrings[a] } func (a AgeGroup) Engarde() (string, error) { @@ -91,7 +86,7 @@ func AgeGroupFromString(content string) (AgeGroup, error) { } } -type Weapon int +type Weapon int32 const ( Epee Weapon = iota @@ -99,17 +94,15 @@ const ( Sabre ) +var WeaponStrings = []string{"Degen", "Florett", "Säbel"} +var WeaponShorts = []string{"D", "F", "S"} + func (w Weapon) String() string { - switch w { - case Epee: - return "D" - case Foil: - return "F" - case Sabre: - return "S" - default: - return fmt.Sprintf("U%d", w) - } + return WeaponStrings[w] +} + +func (w Weapon) ShortString() string { + return WeaponShorts[w] } func (w Weapon) Engarde() (string, error) { |