forked from smallnest/rpcx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectmode_enumer.go
53 lines (43 loc) ยท 1.4 KB
/
selectmode_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
51
52
53
// Code generated by "enumer -type=SelectMode"; DO NOT EDIT.
package client
import (
"fmt"
)
const _SelectModeName = "RandomSelectRoundRobinWeightedRoundRobinWeightedICMPConsistentHashClosest"
var _SelectModeIndex = [...]uint8{0, 12, 22, 40, 52, 66, 73}
func (i SelectMode) String() string {
if i < 0 || i >= SelectMode(len(_SelectModeIndex)-1) {
return fmt.Sprintf("SelectMode(%d)", i)
}
return _SelectModeName[_SelectModeIndex[i]:_SelectModeIndex[i+1]]
}
var _SelectModeValues = []SelectMode{0, 1, 2, 3, 4, 5}
var _SelectModeNameToValueMap = map[string]SelectMode{
_SelectModeName[0:12]: 0,
_SelectModeName[12:22]: 1,
_SelectModeName[22:40]: 2,
_SelectModeName[40:52]: 3,
_SelectModeName[52:66]: 4,
_SelectModeName[66:73]: 5,
}
// SelectModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func SelectModeString(s string) (SelectMode, error) {
if val, ok := _SelectModeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to SelectMode values", s)
}
// SelectModeValues returns all values of the enum
func SelectModeValues() []SelectMode {
return _SelectModeValues
}
// IsASelectMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i SelectMode) IsASelectMode() bool {
for _, v := range _SelectModeValues {
if i == v {
return true
}
}
return false
}