-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfldname_enumer.go
More file actions
53 lines (43 loc) · 1.31 KB
/
fldname_enumer.go
File metadata and controls
53 lines (43 loc) · 1.31 KB
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=fldName -transform=snake -trimprefix=field"; DO NOT EDIT.
package miio
import (
"fmt"
)
const _fldNameName = "rgbtemperaturehumidityvoltagestatusno_motion"
var _fldNameIndex = [...]uint8{0, 3, 14, 22, 29, 35, 44}
func (i fldName) String() string {
if i < 0 || i >= fldName(len(_fldNameIndex)-1) {
return fmt.Sprintf("fldName(%d)", i)
}
return _fldNameName[_fldNameIndex[i]:_fldNameIndex[i+1]]
}
var _fldNameValues = []fldName{0, 1, 2, 3, 4, 5}
var _fldNameNameToValueMap = map[string]fldName{
_fldNameName[0:3]: 0,
_fldNameName[3:14]: 1,
_fldNameName[14:22]: 2,
_fldNameName[22:29]: 3,
_fldNameName[29:35]: 4,
_fldNameName[35:44]: 5,
}
// fldNameString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func fldNameString(s string) (fldName, error) {
if val, ok := _fldNameNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to fldName values", s)
}
// fldNameValues returns all values of the enum
func fldNameValues() []fldName {
return _fldNameValues
}
// IsAfldName returns "true" if the value is listed in the enum definition. "false" otherwise
func (i fldName) IsAfldName() bool {
for _, v := range _fldNameValues {
if i == v {
return true
}
}
return false
}