Restructure project
This commit is contained in:
parent
e44e7caa11
commit
16b2f17301
46 changed files with 1744 additions and 1265 deletions
59
internal/types/types.go
Normal file
59
internal/types/types.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
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"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue