/
mode_enumer.go
50 lines (40 loc) · 1.05 KB
/
mode_enumer.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
// Code generated by "enumer -type=Mode"; DO NOT EDIT.
//
package frontend
import (
"fmt"
)
const _ModeName = "DevelopmentRelease"
var _ModeIndex = [...]uint8{0, 11, 18}
func (i Mode) String() string {
if i < 0 || i >= Mode(len(_ModeIndex)-1) {
return fmt.Sprintf("Mode(%d)", i)
}
return _ModeName[_ModeIndex[i]:_ModeIndex[i+1]]
}
var _ModeValues = []Mode{0, 1}
var _ModeNameToValueMap = map[string]Mode{
_ModeName[0:11]: 0,
_ModeName[11:18]: 1,
}
// ModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ModeString(s string) (Mode, error) {
if val, ok := _ModeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to Mode values", s)
}
// ModeValues returns all values of the enum
func ModeValues() []Mode {
return _ModeValues
}
// IsAMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i Mode) IsAMode() bool {
for _, v := range _ModeValues {
if i == v {
return true
}
}
return false
}