-
Notifications
You must be signed in to change notification settings - Fork 0
/
planner_preview_type.go
46 lines (44 loc) · 1.28 KB
/
planner_preview_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package models
import (
"errors"
)
//
type PlannerPreviewType int
const (
AUTOMATIC_PLANNERPREVIEWTYPE PlannerPreviewType = iota
NOPREVIEW_PLANNERPREVIEWTYPE
CHECKLIST_PLANNERPREVIEWTYPE
DESCRIPTION_PLANNERPREVIEWTYPE
REFERENCE_PLANNERPREVIEWTYPE
)
func (i PlannerPreviewType) String() string {
return []string{"automatic", "noPreview", "checklist", "description", "reference"}[i]
}
func ParsePlannerPreviewType(v string) (any, error) {
result := AUTOMATIC_PLANNERPREVIEWTYPE
switch v {
case "automatic":
result = AUTOMATIC_PLANNERPREVIEWTYPE
case "noPreview":
result = NOPREVIEW_PLANNERPREVIEWTYPE
case "checklist":
result = CHECKLIST_PLANNERPREVIEWTYPE
case "description":
result = DESCRIPTION_PLANNERPREVIEWTYPE
case "reference":
result = REFERENCE_PLANNERPREVIEWTYPE
default:
return 0, errors.New("Unknown PlannerPreviewType value: " + v)
}
return &result, nil
}
func SerializePlannerPreviewType(values []PlannerPreviewType) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i PlannerPreviewType) isMultiValue() bool {
return false
}