summaryrefslogtreecommitdiff
path: root/types.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2022-02-01 10:57:27 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2022-02-01 10:57:27 +0100
commite9afb0fdeb25eb760e2af17bfd5b904845955c2c (patch)
treede5a740dd54ea701158c3599d2c51dbce1d74d68 /types.go
parentcb105e76493c5459f6786987ad40482b4e9698c7 (diff)
downloadengarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.tar.gz
engarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.tar.bz2
engarde-importer-e9afb0fdeb25eb760e2af17bfd5b904845955c2c.zip
Combo Boxes
Diffstat (limited to 'types.go')
-rw-r--r--types.go33
1 files changed, 13 insertions, 20 deletions
diff --git a/types.go b/types.go
index 01c8b5e..a221592 100644
--- a/types.go
+++ b/types.go
@@ -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) {