-
Notifications
You must be signed in to change notification settings - Fork 457
/
adselect_enumer.go
62 lines (50 loc) · 1.56 KB
/
adselect_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
// Code generated by "enumer -type=ADSelect -linecomment -text"; DO NOT EDIT.
package nethelpers
import (
"fmt"
)
const _ADSelectName = "stablebandwidthcount"
var _ADSelectIndex = [...]uint8{0, 6, 15, 20}
func (i ADSelect) String() string {
if i >= ADSelect(len(_ADSelectIndex)-1) {
return fmt.Sprintf("ADSelect(%d)", i)
}
return _ADSelectName[_ADSelectIndex[i]:_ADSelectIndex[i+1]]
}
var _ADSelectValues = []ADSelect{0, 1, 2}
var _ADSelectNameToValueMap = map[string]ADSelect{
_ADSelectName[0:6]: 0,
_ADSelectName[6:15]: 1,
_ADSelectName[15:20]: 2,
}
// ADSelectString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ADSelectString(s string) (ADSelect, error) {
if val, ok := _ADSelectNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ADSelect values", s)
}
// ADSelectValues returns all values of the enum
func ADSelectValues() []ADSelect {
return _ADSelectValues
}
// IsAADSelect returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ADSelect) IsAADSelect() bool {
for _, v := range _ADSelectValues {
if i == v {
return true
}
}
return false
}
// MarshalText implements the encoding.TextMarshaler interface for ADSelect
func (i ADSelect) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for ADSelect
func (i *ADSelect) UnmarshalText(text []byte) error {
var err error
*i, err = ADSelectString(string(text))
return err
}