forked from lkarlslund/ldapnomnom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enums_generated.go
82 lines (67 loc) · 1.98 KB
/
enums_generated.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Code generated by "enumer -output enums_generated.go -type TLSmode enums.go"; DO NOT EDIT.
package main
import (
"fmt"
"strings"
)
const _TLSmodeName = "TLSStartTLSNoTLS"
var _TLSmodeIndex = [...]uint8{0, 3, 11, 16}
const _TLSmodeLowerName = "tlsstarttlsnotls"
func (i TLSmode) String() string {
if i >= TLSmode(len(_TLSmodeIndex)-1) {
return fmt.Sprintf("TLSmode(%d)", i)
}
return _TLSmodeName[_TLSmodeIndex[i]:_TLSmodeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _TLSmodeNoOp() {
var x [1]struct{}
_ = x[TLS-(0)]
_ = x[StartTLS-(1)]
_ = x[NoTLS-(2)]
}
var _TLSmodeValues = []TLSmode{TLS, StartTLS, NoTLS}
var _TLSmodeNameToValueMap = map[string]TLSmode{
_TLSmodeName[0:3]: TLS,
_TLSmodeLowerName[0:3]: TLS,
_TLSmodeName[3:11]: StartTLS,
_TLSmodeLowerName[3:11]: StartTLS,
_TLSmodeName[11:16]: NoTLS,
_TLSmodeLowerName[11:16]: NoTLS,
}
var _TLSmodeNames = []string{
_TLSmodeName[0:3],
_TLSmodeName[3:11],
_TLSmodeName[11:16],
}
// TLSmodeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func TLSmodeString(s string) (TLSmode, error) {
if val, ok := _TLSmodeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _TLSmodeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to TLSmode values", s)
}
// TLSmodeValues returns all values of the enum
func TLSmodeValues() []TLSmode {
return _TLSmodeValues
}
// TLSmodeStrings returns a slice of all String values of the enum
func TLSmodeStrings() []string {
strs := make([]string, len(_TLSmodeNames))
copy(strs, _TLSmodeNames)
return strs
}
// IsATLSmode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i TLSmode) IsATLSmode() bool {
for _, v := range _TLSmodeValues {
if i == v {
return true
}
}
return false
}