cafe-plaetschwiesle/internal/types/types.go
2023-07-04 23:07:23 +02:00

59 lines
940 B
Go

package types
type (
ErrorResponses uint
ItemType uint
NotifierType uint
)
const (
Create NotifierType = iota
Delete
DeleteAll
)
const (
Food ItemType = iota
ColdDrink
HotDrink
)
const (
MissingInformation ErrorResponses = iota
CannotCreate
CannotUpdate
CannotDelete
CannotFind
StillInUse
CannotParse
)
func ParseItemType(itemType string) ItemType {
switch itemType {
case "0":
return Food
case "1":
return ColdDrink
default:
return HotDrink
}
}
func (e ErrorResponses) String() string {
switch e {
case MissingInformation:
return "fehlende Informationen"
case CannotCreate:
return "kann nicht gespeichert werden"
case CannotUpdate:
return "kann nicht geändert werden"
case CannotDelete:
return "kann nicht gelöscht werden"
case CannotFind:
return "kann nicht gefunden werden"
case StillInUse:
return "noch in Verwendung"
default:
return "kann nicht verarbeitet werden"
}
}