-
Notifications
You must be signed in to change notification settings - Fork 21
/
string.go
168 lines (140 loc) · 4.84 KB
/
string.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Code generated by "enumer -type=CheckType,CheckClass -trimprefix=CheckType,CheckClass -transform=lower -output=string.go"; DO NOT EDIT.
package synthetic_monitoring
import (
"fmt"
"strings"
)
const _CheckTypeName = "dnshttppingtcptraceroutek6multihttp"
var _CheckTypeIndex = [...]uint8{0, 3, 7, 11, 14, 24, 26, 35}
const _CheckTypeLowerName = "dnshttppingtcptraceroutek6multihttp"
func (i CheckType) String() string {
if i < 0 || i >= CheckType(len(_CheckTypeIndex)-1) {
return fmt.Sprintf("CheckType(%d)", i)
}
return _CheckTypeName[_CheckTypeIndex[i]:_CheckTypeIndex[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 _CheckTypeNoOp() {
var x [1]struct{}
_ = x[CheckTypeDns-(0)]
_ = x[CheckTypeHttp-(1)]
_ = x[CheckTypePing-(2)]
_ = x[CheckTypeTcp-(3)]
_ = x[CheckTypeTraceroute-(4)]
_ = x[CheckTypeK6-(5)]
_ = x[CheckTypeMultiHttp-(6)]
}
var _CheckTypeValues = []CheckType{CheckTypeDns, CheckTypeHttp, CheckTypePing, CheckTypeTcp, CheckTypeTraceroute, CheckTypeK6, CheckTypeMultiHttp}
var _CheckTypeNameToValueMap = map[string]CheckType{
_CheckTypeName[0:3]: CheckTypeDns,
_CheckTypeLowerName[0:3]: CheckTypeDns,
_CheckTypeName[3:7]: CheckTypeHttp,
_CheckTypeLowerName[3:7]: CheckTypeHttp,
_CheckTypeName[7:11]: CheckTypePing,
_CheckTypeLowerName[7:11]: CheckTypePing,
_CheckTypeName[11:14]: CheckTypeTcp,
_CheckTypeLowerName[11:14]: CheckTypeTcp,
_CheckTypeName[14:24]: CheckTypeTraceroute,
_CheckTypeLowerName[14:24]: CheckTypeTraceroute,
_CheckTypeName[24:26]: CheckTypeK6,
_CheckTypeLowerName[24:26]: CheckTypeK6,
_CheckTypeName[26:35]: CheckTypeMultiHttp,
_CheckTypeLowerName[26:35]: CheckTypeMultiHttp,
}
var _CheckTypeNames = []string{
_CheckTypeName[0:3],
_CheckTypeName[3:7],
_CheckTypeName[7:11],
_CheckTypeName[11:14],
_CheckTypeName[14:24],
_CheckTypeName[24:26],
_CheckTypeName[26:35],
}
// CheckTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CheckTypeString(s string) (CheckType, error) {
if val, ok := _CheckTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _CheckTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to CheckType values", s)
}
// CheckTypeValues returns all values of the enum
func CheckTypeValues() []CheckType {
return _CheckTypeValues
}
// CheckTypeStrings returns a slice of all String values of the enum
func CheckTypeStrings() []string {
strs := make([]string, len(_CheckTypeNames))
copy(strs, _CheckTypeNames)
return strs
}
// IsACheckType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i CheckType) IsACheckType() bool {
for _, v := range _CheckTypeValues {
if i == v {
return true
}
}
return false
}
const _CheckClassName = "protocolscripted"
var _CheckClassIndex = [...]uint8{0, 8, 16}
const _CheckClassLowerName = "protocolscripted"
func (i CheckClass) String() string {
if i < 0 || i >= CheckClass(len(_CheckClassIndex)-1) {
return fmt.Sprintf("CheckClass(%d)", i)
}
return _CheckClassName[_CheckClassIndex[i]:_CheckClassIndex[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 _CheckClassNoOp() {
var x [1]struct{}
_ = x[CheckClassProtocol-(0)]
_ = x[CheckClassScripted-(1)]
}
var _CheckClassValues = []CheckClass{CheckClassProtocol, CheckClassScripted}
var _CheckClassNameToValueMap = map[string]CheckClass{
_CheckClassName[0:8]: CheckClassProtocol,
_CheckClassLowerName[0:8]: CheckClassProtocol,
_CheckClassName[8:16]: CheckClassScripted,
_CheckClassLowerName[8:16]: CheckClassScripted,
}
var _CheckClassNames = []string{
_CheckClassName[0:8],
_CheckClassName[8:16],
}
// CheckClassString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CheckClassString(s string) (CheckClass, error) {
if val, ok := _CheckClassNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _CheckClassNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to CheckClass values", s)
}
// CheckClassValues returns all values of the enum
func CheckClassValues() []CheckClass {
return _CheckClassValues
}
// CheckClassStrings returns a slice of all String values of the enum
func CheckClassStrings() []string {
strs := make([]string, len(_CheckClassNames))
copy(strs, _CheckClassNames)
return strs
}
// IsACheckClass returns "true" if the value is listed in the enum definition. "false" otherwise
func (i CheckClass) IsACheckClass() bool {
for _, v := range _CheckClassValues {
if i == v {
return true
}
}
return false
}