-
Notifications
You must be signed in to change notification settings - Fork 0
/
authenticationmethods_enumer.go
97 lines (79 loc) · 3 KB
/
authenticationmethods_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
// Code generated by "enumer -type=AuthenticationMethods -transform=snake -trimprefix=AuthMeth -json -text -yaml"; DO NOT EDIT.
//
package august
import (
"encoding/json"
"fmt"
)
const _AuthenticationMethodsName = "phoneemail"
var _AuthenticationMethodsIndex = [...]uint8{0, 5, 10}
func (i AuthenticationMethods) String() string {
if i < 0 || i >= AuthenticationMethods(len(_AuthenticationMethodsIndex)-1) {
return fmt.Sprintf("AuthenticationMethods(%d)", i)
}
return _AuthenticationMethodsName[_AuthenticationMethodsIndex[i]:_AuthenticationMethodsIndex[i+1]]
}
var _AuthenticationMethodsValues = []AuthenticationMethods{0, 1}
var _AuthenticationMethodsNameToValueMap = map[string]AuthenticationMethods{
_AuthenticationMethodsName[0:5]: 0,
_AuthenticationMethodsName[5:10]: 1,
}
// AuthenticationMethodsString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func AuthenticationMethodsString(s string) (AuthenticationMethods, error) {
if val, ok := _AuthenticationMethodsNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to AuthenticationMethods values", s)
}
// AuthenticationMethodsValues returns all values of the enum
func AuthenticationMethodsValues() []AuthenticationMethods {
return _AuthenticationMethodsValues
}
// IsAAuthenticationMethods returns "true" if the value is listed in the enum definition. "false" otherwise
func (i AuthenticationMethods) IsAAuthenticationMethods() bool {
for _, v := range _AuthenticationMethodsValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for AuthenticationMethods
func (i AuthenticationMethods) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for AuthenticationMethods
func (i *AuthenticationMethods) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("AuthenticationMethods should be a string, got %s", data)
}
var err error
*i, err = AuthenticationMethodsString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for AuthenticationMethods
func (i AuthenticationMethods) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for AuthenticationMethods
func (i *AuthenticationMethods) UnmarshalText(text []byte) error {
var err error
*i, err = AuthenticationMethodsString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for AuthenticationMethods
func (i AuthenticationMethods) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for AuthenticationMethods
func (i *AuthenticationMethods) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = AuthenticationMethodsString(s)
return err
}