-
Notifications
You must be signed in to change notification settings - Fork 0
/
notification_type_enumer.gen.go
95 lines (77 loc) · 2.84 KB
/
notification_type_enumer.gen.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Code generated by "enumer -type=NotificationType -yaml -trimprefix NotificationType -output notification_type_enumer.gen.go"; DO NOT EDIT.
package gdnotify
import (
"fmt"
"strings"
)
const _NotificationTypeName = "EventBridgeFile"
var _NotificationTypeIndex = [...]uint8{0, 11, 15}
const _NotificationTypeLowerName = "eventbridgefile"
func (i NotificationType) String() string {
if i < 0 || i >= NotificationType(len(_NotificationTypeIndex)-1) {
return fmt.Sprintf("NotificationType(%d)", i)
}
return _NotificationTypeName[_NotificationTypeIndex[i]:_NotificationTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _NotificationTypeNoOp() {
var x [1]struct{}
_ = x[NotificationTypeEventBridge-(0)]
_ = x[NotificationTypeFile-(1)]
}
var _NotificationTypeValues = []NotificationType{NotificationTypeEventBridge, NotificationTypeFile}
var _NotificationTypeNameToValueMap = map[string]NotificationType{
_NotificationTypeName[0:11]: NotificationTypeEventBridge,
_NotificationTypeLowerName[0:11]: NotificationTypeEventBridge,
_NotificationTypeName[11:15]: NotificationTypeFile,
_NotificationTypeLowerName[11:15]: NotificationTypeFile,
}
var _NotificationTypeNames = []string{
_NotificationTypeName[0:11],
_NotificationTypeName[11:15],
}
// NotificationTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func NotificationTypeString(s string) (NotificationType, error) {
if val, ok := _NotificationTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _NotificationTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to NotificationType values", s)
}
// NotificationTypeValues returns all values of the enum
func NotificationTypeValues() []NotificationType {
return _NotificationTypeValues
}
// NotificationTypeStrings returns a slice of all String values of the enum
func NotificationTypeStrings() []string {
strs := make([]string, len(_NotificationTypeNames))
copy(strs, _NotificationTypeNames)
return strs
}
// IsANotificationType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i NotificationType) IsANotificationType() bool {
for _, v := range _NotificationTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalYAML implements a YAML Marshaler for NotificationType
func (i NotificationType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for NotificationType
func (i *NotificationType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = NotificationTypeString(s)
return err
}