-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_mode_enumer.gen.go
86 lines (71 loc) · 2.28 KB
/
run_mode_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
// Code generated by "enumer -type=RunMode -trimprefix RunMode -output run_mode_enumer.gen.go run_mode.go"; DO NOT EDIT.
package gdnotify
import (
"fmt"
"strings"
)
const _RunModeName = "CLIWebhookMaintainerSyncer"
var _RunModeIndex = [...]uint8{0, 3, 10, 20, 26}
const _RunModeLowerName = "cliwebhookmaintainersyncer"
func (i RunMode) String() string {
if i < 0 || i >= RunMode(len(_RunModeIndex)-1) {
return fmt.Sprintf("RunMode(%d)", i)
}
return _RunModeName[_RunModeIndex[i]:_RunModeIndex[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 _RunModeNoOp() {
var x [1]struct{}
_ = x[RunModeCLI-(0)]
_ = x[RunModeWebhook-(1)]
_ = x[RunModeMaintainer-(2)]
_ = x[RunModeSyncer-(3)]
}
var _RunModeValues = []RunMode{RunModeCLI, RunModeWebhook, RunModeMaintainer, RunModeSyncer}
var _RunModeNameToValueMap = map[string]RunMode{
_RunModeName[0:3]: RunModeCLI,
_RunModeLowerName[0:3]: RunModeCLI,
_RunModeName[3:10]: RunModeWebhook,
_RunModeLowerName[3:10]: RunModeWebhook,
_RunModeName[10:20]: RunModeMaintainer,
_RunModeLowerName[10:20]: RunModeMaintainer,
_RunModeName[20:26]: RunModeSyncer,
_RunModeLowerName[20:26]: RunModeSyncer,
}
var _RunModeNames = []string{
_RunModeName[0:3],
_RunModeName[3:10],
_RunModeName[10:20],
_RunModeName[20:26],
}
// RunModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func RunModeString(s string) (RunMode, error) {
if val, ok := _RunModeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _RunModeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to RunMode values", s)
}
// RunModeValues returns all values of the enum
func RunModeValues() []RunMode {
return _RunModeValues
}
// RunModeStrings returns a slice of all String values of the enum
func RunModeStrings() []string {
strs := make([]string, len(_RunModeNames))
copy(strs, _RunModeNames)
return strs
}
// IsARunMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i RunMode) IsARunMode() bool {
for _, v := range _RunModeValues {
if i == v {
return true
}
}
return false
}