forked from zitadel/oidc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
applicationtype_enumer.go
342 lines (282 loc) · 9.34 KB
/
applicationtype_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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
// Code generated by "enumer -linecomment -sql -json -text -yaml -gqlgen -type=ApplicationType,AccessTokenType"; DO NOT EDIT.
package op
import (
"database/sql/driver"
"encoding/json"
"fmt"
"io"
"strconv"
"strings"
)
const _ApplicationTypeName = "webuser_agentnative"
var _ApplicationTypeIndex = [...]uint8{0, 3, 13, 19}
const _ApplicationTypeLowerName = "webuser_agentnative"
func (i ApplicationType) String() string {
if i < 0 || i >= ApplicationType(len(_ApplicationTypeIndex)-1) {
return fmt.Sprintf("ApplicationType(%d)", i)
}
return _ApplicationTypeName[_ApplicationTypeIndex[i]:_ApplicationTypeIndex[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 _ApplicationTypeNoOp() {
var x [1]struct{}
_ = x[ApplicationTypeWeb-(0)]
_ = x[ApplicationTypeUserAgent-(1)]
_ = x[ApplicationTypeNative-(2)]
}
var _ApplicationTypeValues = []ApplicationType{ApplicationTypeWeb, ApplicationTypeUserAgent, ApplicationTypeNative}
var _ApplicationTypeNameToValueMap = map[string]ApplicationType{
_ApplicationTypeName[0:3]: ApplicationTypeWeb,
_ApplicationTypeLowerName[0:3]: ApplicationTypeWeb,
_ApplicationTypeName[3:13]: ApplicationTypeUserAgent,
_ApplicationTypeLowerName[3:13]: ApplicationTypeUserAgent,
_ApplicationTypeName[13:19]: ApplicationTypeNative,
_ApplicationTypeLowerName[13:19]: ApplicationTypeNative,
}
var _ApplicationTypeNames = []string{
_ApplicationTypeName[0:3],
_ApplicationTypeName[3:13],
_ApplicationTypeName[13:19],
}
// ApplicationTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ApplicationTypeString(s string) (ApplicationType, error) {
if val, ok := _ApplicationTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _ApplicationTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ApplicationType values", s)
}
// ApplicationTypeValues returns all values of the enum
func ApplicationTypeValues() []ApplicationType {
return _ApplicationTypeValues
}
// ApplicationTypeStrings returns a slice of all String values of the enum
func ApplicationTypeStrings() []string {
strs := make([]string, len(_ApplicationTypeNames))
copy(strs, _ApplicationTypeNames)
return strs
}
// IsAApplicationType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ApplicationType) IsAApplicationType() bool {
for _, v := range _ApplicationTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for ApplicationType
func (i ApplicationType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for ApplicationType
func (i *ApplicationType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ApplicationType should be a string, got %s", data)
}
var err error
*i, err = ApplicationTypeString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for ApplicationType
func (i ApplicationType) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for ApplicationType
func (i *ApplicationType) UnmarshalText(text []byte) error {
var err error
*i, err = ApplicationTypeString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for ApplicationType
func (i ApplicationType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for ApplicationType
func (i *ApplicationType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = ApplicationTypeString(s)
return err
}
func (i ApplicationType) Value() (driver.Value, error) {
return i.String(), nil
}
func (i *ApplicationType) Scan(value interface{}) error {
if value == nil {
return nil
}
var str string
switch v := value.(type) {
case []byte:
str = string(v)
case string:
str = v
case fmt.Stringer:
str = v.String()
default:
return fmt.Errorf("invalid value of ApplicationType: %[1]T(%[1]v)", value)
}
val, err := ApplicationTypeString(str)
if err != nil {
return err
}
*i = val
return nil
}
// MarshalGQL implements the graphql.Marshaler interface for ApplicationType
func (i ApplicationType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(i.String()))
}
// UnmarshalGQL implements the graphql.Unmarshaler interface for ApplicationType
func (i *ApplicationType) UnmarshalGQL(value interface{}) error {
str, ok := value.(string)
if !ok {
return fmt.Errorf("ApplicationType should be a string, got %T", value)
}
var err error
*i, err = ApplicationTypeString(str)
return err
}
const _AccessTokenTypeName = "bearerJWT"
var _AccessTokenTypeIndex = [...]uint8{0, 6, 9}
const _AccessTokenTypeLowerName = "bearerjwt"
func (i AccessTokenType) String() string {
if i < 0 || i >= AccessTokenType(len(_AccessTokenTypeIndex)-1) {
return fmt.Sprintf("AccessTokenType(%d)", i)
}
return _AccessTokenTypeName[_AccessTokenTypeIndex[i]:_AccessTokenTypeIndex[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 _AccessTokenTypeNoOp() {
var x [1]struct{}
_ = x[AccessTokenTypeBearer-(0)]
_ = x[AccessTokenTypeJWT-(1)]
}
var _AccessTokenTypeValues = []AccessTokenType{AccessTokenTypeBearer, AccessTokenTypeJWT}
var _AccessTokenTypeNameToValueMap = map[string]AccessTokenType{
_AccessTokenTypeName[0:6]: AccessTokenTypeBearer,
_AccessTokenTypeLowerName[0:6]: AccessTokenTypeBearer,
_AccessTokenTypeName[6:9]: AccessTokenTypeJWT,
_AccessTokenTypeLowerName[6:9]: AccessTokenTypeJWT,
}
var _AccessTokenTypeNames = []string{
_AccessTokenTypeName[0:6],
_AccessTokenTypeName[6:9],
}
// AccessTokenTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func AccessTokenTypeString(s string) (AccessTokenType, error) {
if val, ok := _AccessTokenTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _AccessTokenTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to AccessTokenType values", s)
}
// AccessTokenTypeValues returns all values of the enum
func AccessTokenTypeValues() []AccessTokenType {
return _AccessTokenTypeValues
}
// AccessTokenTypeStrings returns a slice of all String values of the enum
func AccessTokenTypeStrings() []string {
strs := make([]string, len(_AccessTokenTypeNames))
copy(strs, _AccessTokenTypeNames)
return strs
}
// IsAAccessTokenType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i AccessTokenType) IsAAccessTokenType() bool {
for _, v := range _AccessTokenTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for AccessTokenType
func (i AccessTokenType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for AccessTokenType
func (i *AccessTokenType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("AccessTokenType should be a string, got %s", data)
}
var err error
*i, err = AccessTokenTypeString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for AccessTokenType
func (i AccessTokenType) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for AccessTokenType
func (i *AccessTokenType) UnmarshalText(text []byte) error {
var err error
*i, err = AccessTokenTypeString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for AccessTokenType
func (i AccessTokenType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for AccessTokenType
func (i *AccessTokenType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = AccessTokenTypeString(s)
return err
}
func (i AccessTokenType) Value() (driver.Value, error) {
return i.String(), nil
}
func (i *AccessTokenType) Scan(value interface{}) error {
if value == nil {
return nil
}
var str string
switch v := value.(type) {
case []byte:
str = string(v)
case string:
str = v
case fmt.Stringer:
str = v.String()
default:
return fmt.Errorf("invalid value of AccessTokenType: %[1]T(%[1]v)", value)
}
val, err := AccessTokenTypeString(str)
if err != nil {
return err
}
*i = val
return nil
}
// MarshalGQL implements the graphql.Marshaler interface for AccessTokenType
func (i AccessTokenType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(i.String()))
}
// UnmarshalGQL implements the graphql.Unmarshaler interface for AccessTokenType
func (i *AccessTokenType) UnmarshalGQL(value interface{}) error {
str, ok := value.(string)
if !ok {
return fmt.Errorf("AccessTokenType should be a string, got %T", value)
}
var err error
*i, err = AccessTokenTypeString(str)
return err
}