-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.xattrnamespace_enum.go
266 lines (216 loc) · 8.41 KB
/
api.xattrnamespace_enum.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Code generated by "go-enum -type XAttrNamespace --linecomment"; DO NOT EDIT.
package webhdfs
import (
"database/sql"
"database/sql/driver"
"encoding"
"encoding/json"
"fmt"
"strconv"
)
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[XAttrNamespaceUser-0]
_ = x[XAttrNamespaceTrusted-1]
_ = x[XAttrNamespaceSystem-2]
_ = x[XAttrNamespaceSecurity-3]
_ = x[XAttrNamespaceRaw-4]
}
const _XAttrNamespace_name = "usertrustedsystemsecurityraw"
var _XAttrNamespace_index = [...]uint8{0, 4, 11, 17, 25, 28}
func _() {
var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type fmt.Stringer" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ fmt.Stringer = _nil_XAttrNamespace_value
}
func (i XAttrNamespace) String() string {
if i < 0 || i >= XAttrNamespace(len(_XAttrNamespace_index)-1) {
return "XAttrNamespace(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _XAttrNamespace_name[_XAttrNamespace_index[i]:_XAttrNamespace_index[i+1]]
}
// New returns a pointer to a new addr filled with the XAttrNamespace value passed in.
func (i XAttrNamespace) New() *XAttrNamespace {
clone := i
return &clone
}
var _XAttrNamespace_values = []XAttrNamespace{0, 1, 2, 3, 4}
var _XAttrNamespace_name_to_values = map[string]XAttrNamespace{
_XAttrNamespace_name[0:4]: 0,
_XAttrNamespace_name[4:11]: 1,
_XAttrNamespace_name[11:17]: 2,
_XAttrNamespace_name[17:25]: 3,
_XAttrNamespace_name[25:28]: 4,
}
// ParseXAttrNamespaceString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ParseXAttrNamespaceString(s string) (XAttrNamespace, error) {
if val, ok := _XAttrNamespace_name_to_values[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to XAttrNamespace values", s)
}
// XAttrNamespaceValues returns all values of the enum
func XAttrNamespaceValues() []XAttrNamespace {
return _XAttrNamespace_values
}
// IsAXAttrNamespace returns "true" if the value is listed in the enum definition. "false" otherwise
func (i XAttrNamespace) Registered() bool {
for _, v := range _XAttrNamespace_values {
if i == v {
return true
}
}
return false
}
func _() {
var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type encoding.BinaryMarshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ encoding.BinaryMarshaler = &_nil_XAttrNamespace_value
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type encoding.BinaryUnmarshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ encoding.BinaryUnmarshaler = &_nil_XAttrNamespace_value
}
// MarshalBinary implements the encoding.BinaryMarshaler interface for XAttrNamespace
func (i XAttrNamespace) MarshalBinary() (data []byte, err error) {
return []byte(i.String()), nil
}
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for XAttrNamespace
func (i *XAttrNamespace) UnmarshalBinary(data []byte) error {
var err error
*i, err = ParseXAttrNamespaceString(string(data))
return err
}
func _() {
var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type json.Marshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ json.Marshaler = _nil_XAttrNamespace_value
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type encoding.Unmarshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ json.Unmarshaler = &_nil_XAttrNamespace_value
}
// MarshalJSON implements the json.Marshaler interface for XAttrNamespace
func (i XAttrNamespace) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for XAttrNamespace
func (i *XAttrNamespace) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("XAttrNamespace should be a string, got %s", data)
}
var err error
*i, err = ParseXAttrNamespaceString(s)
return err
}
func _() {
var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type encoding.TextMarshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ encoding.TextMarshaler = _nil_XAttrNamespace_value
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type encoding.TextUnmarshaler" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ encoding.TextUnmarshaler = &_nil_XAttrNamespace_value
}
// MarshalText implements the encoding.TextMarshaler interface for XAttrNamespace
func (i XAttrNamespace) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for XAttrNamespace
func (i *XAttrNamespace) UnmarshalText(text []byte) error {
var err error
*i, err = ParseXAttrNamespaceString(string(text))
return err
}
//func _() {
// var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
//
// // An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type yaml.Marshaler" compiler error signifies that the base type have changed.
// // Re-run the go-enum command to generate them again.
// var _ yaml.Marshaler = _nil_XAttrNamespace_value
//
// // An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type yaml.Unmarshaler" compiler error signifies that the base type have changed.
// // Re-run the go-enum command to generate them again.
// var _ yaml.Unmarshaler = &_nil_XAttrNamespace_value
//}
// MarshalYAML implements a YAML Marshaler for XAttrNamespace
func (i XAttrNamespace) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for XAttrNamespace
func (i *XAttrNamespace) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = ParseXAttrNamespaceString(s)
return err
}
func _() {
var _nil_XAttrNamespace_value = func() (val XAttrNamespace) { return }()
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type driver.Valuer" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ driver.Valuer = _nil_XAttrNamespace_value
// An "cannot convert XAttrNamespace literal (type XAttrNamespace) to type sql.Scanner" compiler error signifies that the base type have changed.
// Re-run the go-enum command to generate them again.
var _ sql.Scanner = &_nil_XAttrNamespace_value
}
func (i XAttrNamespace) Value() (driver.Value, error) {
return i.String(), nil
}
func (i *XAttrNamespace) Scan(value interface{}) error {
if value == nil {
return nil
}
str, ok := value.(string)
if !ok {
bytes, ok := value.([]byte)
if !ok {
return fmt.Errorf("value is not a byte slice")
}
str = string(bytes[:])
}
val, err := ParseXAttrNamespaceString(str)
if err != nil {
return err
}
*i = val
return nil
}
// XAttrNamespaceSliceContains reports whether sunEnums is within enums.
func XAttrNamespaceSliceContains(enums []XAttrNamespace, sunEnums ...XAttrNamespace) bool {
var seenEnums = map[XAttrNamespace]bool{}
for _, e := range sunEnums {
seenEnums[e] = false
}
for _, v := range enums {
if _, has := seenEnums[v]; has {
seenEnums[v] = true
}
}
for _, seen := range seenEnums {
if !seen {
return false
}
}
return true
}
// XAttrNamespaceSliceContainsAny reports whether any sunEnum is within enums.
func XAttrNamespaceSliceContainsAny(enums []XAttrNamespace, sunEnums ...XAttrNamespace) bool {
var seenEnums = map[XAttrNamespace]struct{}{}
for _, e := range sunEnums {
seenEnums[e] = struct{}{}
}
for _, v := range enums {
if _, has := seenEnums[v]; has {
return true
}
}
return false
}