github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_fittings_200_ok_easyjson.go (about) 1 // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. 2 3 package esi 4 5 import ( 6 json "encoding/json" 7 8 easyjson "github.com/mailru/easyjson" 9 jlexer "github.com/mailru/easyjson/jlexer" 10 jwriter "github.com/mailru/easyjson/jwriter" 11 ) 12 13 // suppress unused package warning 14 var ( 15 _ *json.RawMessage 16 _ *jlexer.Lexer 17 _ *jwriter.Writer 18 _ easyjson.Marshaler 19 ) 20 21 func easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdFittings200OkList) { 22 isTopLevel := in.IsStart() 23 if in.IsNull() { 24 in.Skip() 25 *out = nil 26 } else { 27 in.Delim('[') 28 if *out == nil { 29 if !in.IsDelim(']') { 30 *out = make(GetCharactersCharacterIdFittings200OkList, 0, 0) 31 } else { 32 *out = GetCharactersCharacterIdFittings200OkList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetCharactersCharacterIdFittings200Ok 39 (v1).UnmarshalEasyJSON(in) 40 *out = append(*out, v1) 41 in.WantComma() 42 } 43 in.Delim(']') 44 } 45 if isTopLevel { 46 in.Consumed() 47 } 48 } 49 func easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdFittings200OkList) { 50 if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { 51 out.RawString("null") 52 } else { 53 out.RawByte('[') 54 for v2, v3 := range in { 55 if v2 > 0 { 56 out.RawByte(',') 57 } 58 (v3).MarshalEasyJSON(out) 59 } 60 out.RawByte(']') 61 } 62 } 63 64 // MarshalJSON supports json.Marshaler interface 65 func (v GetCharactersCharacterIdFittings200OkList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetCharactersCharacterIdFittings200OkList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetCharactersCharacterIdFittings200OkList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetCharactersCharacterIdFittings200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdFittings200Ok) { 88 isTopLevel := in.IsStart() 89 if in.IsNull() { 90 if isTopLevel { 91 in.Consumed() 92 } 93 in.Skip() 94 return 95 } 96 in.Delim('{') 97 for !in.IsDelim('}') { 98 key := in.UnsafeFieldName(false) 99 in.WantColon() 100 if in.IsNull() { 101 in.Skip() 102 in.WantComma() 103 continue 104 } 105 switch key { 106 case "description": 107 out.Description = string(in.String()) 108 case "fitting_id": 109 out.FittingId = int32(in.Int32()) 110 case "items": 111 if in.IsNull() { 112 in.Skip() 113 out.Items = nil 114 } else { 115 in.Delim('[') 116 if out.Items == nil { 117 if !in.IsDelim(']') { 118 out.Items = make([]GetCharactersCharacterIdFittingsItem, 0, 2) 119 } else { 120 out.Items = []GetCharactersCharacterIdFittingsItem{} 121 } 122 } else { 123 out.Items = (out.Items)[:0] 124 } 125 for !in.IsDelim(']') { 126 var v4 GetCharactersCharacterIdFittingsItem 127 easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi2(in, &v4) 128 out.Items = append(out.Items, v4) 129 in.WantComma() 130 } 131 in.Delim(']') 132 } 133 case "name": 134 out.Name = string(in.String()) 135 case "ship_type_id": 136 out.ShipTypeId = int32(in.Int32()) 137 default: 138 in.SkipRecursive() 139 } 140 in.WantComma() 141 } 142 in.Delim('}') 143 if isTopLevel { 144 in.Consumed() 145 } 146 } 147 func easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdFittings200Ok) { 148 out.RawByte('{') 149 first := true 150 _ = first 151 if in.Description != "" { 152 const prefix string = ",\"description\":" 153 first = false 154 out.RawString(prefix[1:]) 155 out.String(string(in.Description)) 156 } 157 if in.FittingId != 0 { 158 const prefix string = ",\"fitting_id\":" 159 if first { 160 first = false 161 out.RawString(prefix[1:]) 162 } else { 163 out.RawString(prefix) 164 } 165 out.Int32(int32(in.FittingId)) 166 } 167 if len(in.Items) != 0 { 168 const prefix string = ",\"items\":" 169 if first { 170 first = false 171 out.RawString(prefix[1:]) 172 } else { 173 out.RawString(prefix) 174 } 175 { 176 out.RawByte('[') 177 for v5, v6 := range in.Items { 178 if v5 > 0 { 179 out.RawByte(',') 180 } 181 easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi2(out, v6) 182 } 183 out.RawByte(']') 184 } 185 } 186 if in.Name != "" { 187 const prefix string = ",\"name\":" 188 if first { 189 first = false 190 out.RawString(prefix[1:]) 191 } else { 192 out.RawString(prefix) 193 } 194 out.String(string(in.Name)) 195 } 196 if in.ShipTypeId != 0 { 197 const prefix string = ",\"ship_type_id\":" 198 if first { 199 first = false 200 out.RawString(prefix[1:]) 201 } else { 202 out.RawString(prefix) 203 } 204 out.Int32(int32(in.ShipTypeId)) 205 } 206 out.RawByte('}') 207 } 208 209 // MarshalJSON supports json.Marshaler interface 210 func (v GetCharactersCharacterIdFittings200Ok) MarshalJSON() ([]byte, error) { 211 w := jwriter.Writer{} 212 easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi1(&w, v) 213 return w.Buffer.BuildBytes(), w.Error 214 } 215 216 // MarshalEasyJSON supports easyjson.Marshaler interface 217 func (v GetCharactersCharacterIdFittings200Ok) MarshalEasyJSON(w *jwriter.Writer) { 218 easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi1(w, v) 219 } 220 221 // UnmarshalJSON supports json.Unmarshaler interface 222 func (v *GetCharactersCharacterIdFittings200Ok) UnmarshalJSON(data []byte) error { 223 r := jlexer.Lexer{Data: data} 224 easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi1(&r, v) 225 return r.Error() 226 } 227 228 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 229 func (v *GetCharactersCharacterIdFittings200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) { 230 easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi1(l, v) 231 } 232 func easyjson729ea2d8DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetCharactersCharacterIdFittingsItem) { 233 isTopLevel := in.IsStart() 234 if in.IsNull() { 235 if isTopLevel { 236 in.Consumed() 237 } 238 in.Skip() 239 return 240 } 241 in.Delim('{') 242 for !in.IsDelim('}') { 243 key := in.UnsafeFieldName(false) 244 in.WantColon() 245 if in.IsNull() { 246 in.Skip() 247 in.WantComma() 248 continue 249 } 250 switch key { 251 case "flag": 252 out.Flag = string(in.String()) 253 case "quantity": 254 out.Quantity = int32(in.Int32()) 255 case "type_id": 256 out.TypeId = int32(in.Int32()) 257 default: 258 in.SkipRecursive() 259 } 260 in.WantComma() 261 } 262 in.Delim('}') 263 if isTopLevel { 264 in.Consumed() 265 } 266 } 267 func easyjson729ea2d8EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetCharactersCharacterIdFittingsItem) { 268 out.RawByte('{') 269 first := true 270 _ = first 271 if in.Flag != "" { 272 const prefix string = ",\"flag\":" 273 first = false 274 out.RawString(prefix[1:]) 275 out.String(string(in.Flag)) 276 } 277 if in.Quantity != 0 { 278 const prefix string = ",\"quantity\":" 279 if first { 280 first = false 281 out.RawString(prefix[1:]) 282 } else { 283 out.RawString(prefix) 284 } 285 out.Int32(int32(in.Quantity)) 286 } 287 if in.TypeId != 0 { 288 const prefix string = ",\"type_id\":" 289 if first { 290 first = false 291 out.RawString(prefix[1:]) 292 } else { 293 out.RawString(prefix) 294 } 295 out.Int32(int32(in.TypeId)) 296 } 297 out.RawByte('}') 298 }