-
Notifications
You must be signed in to change notification settings - Fork 457
/
bondmode_enumer.go
66 lines (54 loc) · 1.74 KB
/
bondmode_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
54
55
56
57
58
59
60
61
62
63
64
65
66
// Code generated by "enumer -type=BondMode -linecomment -text"; DO NOT EDIT.
package nethelpers
import (
"fmt"
)
const _BondModeName = "balance-rractive-backupbalance-xorbroadcast802.3adbalance-tlbbalance-alb"
var _BondModeIndex = [...]uint8{0, 10, 23, 34, 43, 50, 61, 72}
func (i BondMode) String() string {
if i >= BondMode(len(_BondModeIndex)-1) {
return fmt.Sprintf("BondMode(%d)", i)
}
return _BondModeName[_BondModeIndex[i]:_BondModeIndex[i+1]]
}
var _BondModeValues = []BondMode{0, 1, 2, 3, 4, 5, 6}
var _BondModeNameToValueMap = map[string]BondMode{
_BondModeName[0:10]: 0,
_BondModeName[10:23]: 1,
_BondModeName[23:34]: 2,
_BondModeName[34:43]: 3,
_BondModeName[43:50]: 4,
_BondModeName[50:61]: 5,
_BondModeName[61:72]: 6,
}
// BondModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func BondModeString(s string) (BondMode, error) {
if val, ok := _BondModeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to BondMode values", s)
}
// BondModeValues returns all values of the enum
func BondModeValues() []BondMode {
return _BondModeValues
}
// IsABondMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i BondMode) IsABondMode() bool {
for _, v := range _BondModeValues {
if i == v {
return true
}
}
return false
}
// MarshalText implements the encoding.TextMarshaler interface for BondMode
func (i BondMode) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for BondMode
func (i *BondMode) UnmarshalText(text []byte) error {
var err error
*i, err = BondModeString(string(text))
return err
}