mirror of
https://github.com/onyx-and-iris/lottery-cli.git
synced 2026-08-17 00:34:25 +00:00
initial commit
This commit is contained in:
30
kinds.go
Normal file
30
kinds.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package lottery
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Kind string
|
||||
|
||||
const (
|
||||
KindLotto Kind = "lotto"
|
||||
KindEuroMillions Kind = "euromillions"
|
||||
KindSetForLife Kind = "setforlife"
|
||||
KindThunderball Kind = "thunderball"
|
||||
KindPowerball Kind = "powerball"
|
||||
)
|
||||
|
||||
func ParseKind(kind string) (Kind, error) {
|
||||
switch kind {
|
||||
case "lotto":
|
||||
return KindLotto, nil
|
||||
case "euromillions":
|
||||
return KindEuroMillions, nil
|
||||
case "setforlife":
|
||||
return KindSetForLife, nil
|
||||
case "thunderball":
|
||||
return KindThunderball, nil
|
||||
case "powerball":
|
||||
return KindPowerball, nil
|
||||
default:
|
||||
return "", fmt.Errorf("invalid lottery kind: %s", kind)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user