github.com/aldelo/common@v1.5.1/wrapper/gin/ginjwtsignalgorithm/ginjwtsignalgorithm_enumer.go (about) 1 // Code Generated By gen-enumer For "Enum Type: GinJwtSignAlgorithm" - DO NOT EDIT; 2 3 /* 4 * Copyright 2020-2023 Aldelo, LP 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package ginjwtsignalgorithm 20 21 import ( 22 "fmt" 23 "strconv" 24 ) 25 26 // enum names constants 27 const ( 28 _GinJwtSignAlgorithmName_0 = "UNKNOWN" 29 _GinJwtSignAlgorithmName_1 = "HS256" 30 _GinJwtSignAlgorithmName_2 = "HS384" 31 _GinJwtSignAlgorithmName_3 = "HS512" 32 _GinJwtSignAlgorithmName_4 = "RS256" 33 _GinJwtSignAlgorithmName_5 = "RS384" 34 _GinJwtSignAlgorithmName_6 = "RS512" 35 ) 36 37 // var declares of enum indexes 38 var ( 39 _GinJwtSignAlgorithmIndex_0 = [...]uint8{0, 7} 40 _GinJwtSignAlgorithmIndex_1 = [...]uint8{0, 5} 41 _GinJwtSignAlgorithmIndex_2 = [...]uint8{0, 5} 42 _GinJwtSignAlgorithmIndex_3 = [...]uint8{0, 5} 43 _GinJwtSignAlgorithmIndex_4 = [...]uint8{0, 5} 44 _GinJwtSignAlgorithmIndex_5 = [...]uint8{0, 5} 45 _GinJwtSignAlgorithmIndex_6 = [...]uint8{0, 5} 46 ) 47 48 func (i GinJwtSignAlgorithm) String() string { 49 switch { 50 case i == UNKNOWN: 51 return _GinJwtSignAlgorithmName_0 52 case i == HS256: 53 return _GinJwtSignAlgorithmName_1 54 case i == HS384: 55 return _GinJwtSignAlgorithmName_2 56 case i == HS512: 57 return _GinJwtSignAlgorithmName_3 58 case i == RS256: 59 return _GinJwtSignAlgorithmName_4 60 case i == RS384: 61 return _GinJwtSignAlgorithmName_5 62 case i == RS512: 63 return _GinJwtSignAlgorithmName_6 64 default: 65 return "" 66 } 67 } 68 69 var _GinJwtSignAlgorithmValues = []GinJwtSignAlgorithm{ 70 0, // UNKNOWN 71 1, // HS256 72 2, // HS384 73 3, // HS512 74 4, // RS256 75 5, // RS384 76 6, // RS512 77 } 78 79 var _GinJwtSignAlgorithmNameToValueMap = map[string]GinJwtSignAlgorithm{ 80 _GinJwtSignAlgorithmName_0[0:7]: 0, // UNKNOWN 81 _GinJwtSignAlgorithmName_1[0:5]: 1, // HS256 82 _GinJwtSignAlgorithmName_2[0:5]: 2, // HS384 83 _GinJwtSignAlgorithmName_3[0:5]: 3, // HS512 84 _GinJwtSignAlgorithmName_4[0:5]: 4, // RS256 85 _GinJwtSignAlgorithmName_5[0:5]: 5, // RS384 86 _GinJwtSignAlgorithmName_6[0:5]: 6, // RS512 87 } 88 89 var _GinJwtSignAlgorithmValueToKeyMap = map[GinJwtSignAlgorithm]string{ 90 0: _GinJwtSignAlgorithmKey_0, // UNKNOWN 91 1: _GinJwtSignAlgorithmKey_1, // HS256 92 2: _GinJwtSignAlgorithmKey_2, // HS384 93 3: _GinJwtSignAlgorithmKey_3, // HS512 94 4: _GinJwtSignAlgorithmKey_4, // RS256 95 5: _GinJwtSignAlgorithmKey_5, // RS384 96 6: _GinJwtSignAlgorithmKey_6, // RS512 97 } 98 99 var _GinJwtSignAlgorithmValueToCaptionMap = map[GinJwtSignAlgorithm]string{ 100 0: _GinJwtSignAlgorithmCaption_0, // UNKNOWN 101 1: _GinJwtSignAlgorithmCaption_1, // HS256 102 2: _GinJwtSignAlgorithmCaption_2, // HS384 103 3: _GinJwtSignAlgorithmCaption_3, // HS512 104 4: _GinJwtSignAlgorithmCaption_4, // RS256 105 5: _GinJwtSignAlgorithmCaption_5, // RS384 106 6: _GinJwtSignAlgorithmCaption_6, // RS512 107 } 108 109 var _GinJwtSignAlgorithmValueToDescriptionMap = map[GinJwtSignAlgorithm]string{ 110 0: _GinJwtSignAlgorithmDescription_0, // UNKNOWN 111 1: _GinJwtSignAlgorithmDescription_1, // HS256 112 2: _GinJwtSignAlgorithmDescription_2, // HS384 113 3: _GinJwtSignAlgorithmDescription_3, // HS512 114 4: _GinJwtSignAlgorithmDescription_4, // RS256 115 5: _GinJwtSignAlgorithmDescription_5, // RS384 116 6: _GinJwtSignAlgorithmDescription_6, // RS512 117 } 118 119 // Valid returns 'true' if the value is listed in the GinJwtSignAlgorithm enum map definition, 'false' otherwise 120 func (i GinJwtSignAlgorithm) Valid() bool { 121 for _, v := range _GinJwtSignAlgorithmValues { 122 if i == v { 123 return true 124 } 125 } 126 127 return false 128 } 129 130 // ParseByName retrieves a GinJwtSignAlgorithm enum value from the enum string name, 131 // throws an error if the param is not part of the enum 132 func (i GinJwtSignAlgorithm) ParseByName(s string) (GinJwtSignAlgorithm, error) { 133 if val, ok := _GinJwtSignAlgorithmNameToValueMap[s]; ok { 134 // parse ok 135 return val, nil 136 } 137 138 // error 139 return -1, fmt.Errorf("Enum Name of %s Not Expected In GinJwtSignAlgorithm Values List", s) 140 } 141 142 // ParseByKey retrieves a GinJwtSignAlgorithm enum value from the enum string key, 143 // throws an error if the param is not part of the enum 144 func (i GinJwtSignAlgorithm) ParseByKey(s string) (GinJwtSignAlgorithm, error) { 145 for k, v := range _GinJwtSignAlgorithmValueToKeyMap { 146 if v == s { 147 // parse ok 148 return k, nil 149 } 150 } 151 152 // error 153 return -1, fmt.Errorf("Enum Key of %s Not Expected In GinJwtSignAlgorithm Keys List", s) 154 } 155 156 // Key retrieves a GinJwtSignAlgorithm enum string key 157 func (i GinJwtSignAlgorithm) Key() string { 158 if val, ok := _GinJwtSignAlgorithmValueToKeyMap[i]; ok { 159 // found 160 return val 161 } else { 162 // not found 163 return "" 164 } 165 } 166 167 // Caption retrieves a GinJwtSignAlgorithm enum string caption 168 func (i GinJwtSignAlgorithm) Caption() string { 169 if val, ok := _GinJwtSignAlgorithmValueToCaptionMap[i]; ok { 170 // found 171 return val 172 } else { 173 // not found 174 return "" 175 } 176 } 177 178 // Description retrieves a GinJwtSignAlgorithm enum string description 179 func (i GinJwtSignAlgorithm) Description() string { 180 if val, ok := _GinJwtSignAlgorithmValueToDescriptionMap[i]; ok { 181 // found 182 return val 183 } else { 184 // not found 185 return "" 186 } 187 } 188 189 // IntValue gets the intrinsic enum integer value 190 func (i GinJwtSignAlgorithm) IntValue() int { 191 return int(i) 192 } 193 194 // IntString gets the intrinsic enum integer value represented in string format 195 func (i GinJwtSignAlgorithm) IntString() string { 196 return strconv.Itoa(int(i)) 197 } 198 199 // ValueSlice returns all values of the enum GinJwtSignAlgorithm in a slice 200 func (i GinJwtSignAlgorithm) ValueSlice() []GinJwtSignAlgorithm { 201 return _GinJwtSignAlgorithmValues 202 } 203 204 // NameMap returns all names of the enum GinJwtSignAlgorithm in a K:name,V:GinJwtSignAlgorithm map 205 func (i GinJwtSignAlgorithm) NameMap() map[string]GinJwtSignAlgorithm { 206 return _GinJwtSignAlgorithmNameToValueMap 207 } 208 209 // KeyMap returns all keys of the enum GinJwtSignAlgorithm in a K:GinJwtSignAlgorithm,V:key map 210 func (i GinJwtSignAlgorithm) KeyMap() map[GinJwtSignAlgorithm]string { 211 return _GinJwtSignAlgorithmValueToKeyMap 212 } 213 214 // CaptionMap returns all captions of the enum GinJwtSignAlgorithm in a K:GinJwtSignAlgorithm,V:caption map 215 func (i GinJwtSignAlgorithm) CaptionMap() map[GinJwtSignAlgorithm]string { 216 return _GinJwtSignAlgorithmValueToCaptionMap 217 } 218 219 // DescriptionMap returns all descriptions of the enum GinJwtSignAlgorithm in a K:GinJwtSignAlgorithm,V:description map 220 func (i GinJwtSignAlgorithm) DescriptionMap() map[GinJwtSignAlgorithm]string { 221 return _GinJwtSignAlgorithmValueToDescriptionMap 222 }