Fix broken switch statement

This commit is contained in:
Jan Philipp Timme 2019-01-01 15:13:18 +01:00
parent 8dea3f83bc
commit 23277a9159
1 changed files with 4 additions and 10 deletions

View File

@ -70,13 +70,7 @@ func NewSortConfig() qEntrySortConfig {
func isQEntryAttribute(attributeName string) bool { func isQEntryAttribute(attributeName string) bool {
var isValidAttribute bool var isValidAttribute bool
switch attributeName { switch attributeName {
case "Id": case "Id", "Status", "Date", "Size", "Sender", "Recipients", "Reason":
case "Status":
case "Date":
case "Size":
case "Sender":
case "Recipients":
case "Reason":
isValidAttribute = true isValidAttribute = true
default: default:
isValidAttribute = false isValidAttribute = false
@ -88,9 +82,9 @@ func (c qEntrySortConfig) By(attributeName string, order string) qEntrySortConfi
if !isQEntryAttribute(attributeName) { if !isQEntryAttribute(attributeName) {
panic(fmt.Sprintf("Invalid sort attribute: '%s' given!", attributeName)) panic(fmt.Sprintf("Invalid sort attribute: '%s' given!", attributeName))
} }
if order != "ASC" && order != "DESC" { if order != "ASC" && order != "DESC" {
panic(fmt.Sprintf("Invalid sort order '%s' given!", order)) panic(fmt.Sprintf("Invalid sort order '%s' given!", order))
} }
newAttributeConfig := qEntryAttributeSortConfig{attribute: attributeName, order: order} newAttributeConfig := qEntryAttributeSortConfig{attribute: attributeName, order: order}
c.attributes = append(c.attributes, newAttributeConfig) c.attributes = append(c.attributes, newAttributeConfig)
return c return c