github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_post_characters_character_id_fittings_fitting_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 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *PostCharactersCharacterIdFittingsFittingList) { 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(PostCharactersCharacterIdFittingsFittingList, 0, 1) 31 } else { 32 *out = PostCharactersCharacterIdFittingsFittingList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 PostCharactersCharacterIdFittingsFitting 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 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in PostCharactersCharacterIdFittingsFittingList) { 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 PostCharactersCharacterIdFittingsFittingList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v PostCharactersCharacterIdFittingsFittingList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *PostCharactersCharacterIdFittingsFittingList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *PostCharactersCharacterIdFittingsFittingList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *PostCharactersCharacterIdFittingsFitting) { 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 "items": 109 if in.IsNull() { 110 in.Skip() 111 out.Items = nil 112 } else { 113 in.Delim('[') 114 if out.Items == nil { 115 if !in.IsDelim(']') { 116 out.Items = make([]PostCharactersCharacterIdFittingsItem, 0, 2) 117 } else { 118 out.Items = []PostCharactersCharacterIdFittingsItem{} 119 } 120 } else { 121 out.Items = (out.Items)[:0] 122 } 123 for !in.IsDelim(']') { 124 var v4 PostCharactersCharacterIdFittingsItem 125 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi2(in, &v4) 126 out.Items = append(out.Items, v4) 127 in.WantComma() 128 } 129 in.Delim(']') 130 } 131 case "name": 132 out.Name = string(in.String()) 133 case "ship_type_id": 134 out.ShipTypeId = int32(in.Int32()) 135 default: 136 in.SkipRecursive() 137 } 138 in.WantComma() 139 } 140 in.Delim('}') 141 if isTopLevel { 142 in.Consumed() 143 } 144 } 145 func easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in PostCharactersCharacterIdFittingsFitting) { 146 out.RawByte('{') 147 first := true 148 _ = first 149 if in.Description != "" { 150 const prefix string = ",\"description\":" 151 first = false 152 out.RawString(prefix[1:]) 153 out.String(string(in.Description)) 154 } 155 if len(in.Items) != 0 { 156 const prefix string = ",\"items\":" 157 if first { 158 first = false 159 out.RawString(prefix[1:]) 160 } else { 161 out.RawString(prefix) 162 } 163 { 164 out.RawByte('[') 165 for v5, v6 := range in.Items { 166 if v5 > 0 { 167 out.RawByte(',') 168 } 169 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi2(out, v6) 170 } 171 out.RawByte(']') 172 } 173 } 174 if in.Name != "" { 175 const prefix string = ",\"name\":" 176 if first { 177 first = false 178 out.RawString(prefix[1:]) 179 } else { 180 out.RawString(prefix) 181 } 182 out.String(string(in.Name)) 183 } 184 if in.ShipTypeId != 0 { 185 const prefix string = ",\"ship_type_id\":" 186 if first { 187 first = false 188 out.RawString(prefix[1:]) 189 } else { 190 out.RawString(prefix) 191 } 192 out.Int32(int32(in.ShipTypeId)) 193 } 194 out.RawByte('}') 195 } 196 197 // MarshalJSON supports json.Marshaler interface 198 func (v PostCharactersCharacterIdFittingsFitting) MarshalJSON() ([]byte, error) { 199 w := jwriter.Writer{} 200 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi1(&w, v) 201 return w.Buffer.BuildBytes(), w.Error 202 } 203 204 // MarshalEasyJSON supports easyjson.Marshaler interface 205 func (v PostCharactersCharacterIdFittingsFitting) MarshalEasyJSON(w *jwriter.Writer) { 206 easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi1(w, v) 207 } 208 209 // UnmarshalJSON supports json.Unmarshaler interface 210 func (v *PostCharactersCharacterIdFittingsFitting) UnmarshalJSON(data []byte) error { 211 r := jlexer.Lexer{Data: data} 212 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi1(&r, v) 213 return r.Error() 214 } 215 216 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 217 func (v *PostCharactersCharacterIdFittingsFitting) UnmarshalEasyJSON(l *jlexer.Lexer) { 218 easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi1(l, v) 219 } 220 func easyjsonC29a6102DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *PostCharactersCharacterIdFittingsItem) { 221 isTopLevel := in.IsStart() 222 if in.IsNull() { 223 if isTopLevel { 224 in.Consumed() 225 } 226 in.Skip() 227 return 228 } 229 in.Delim('{') 230 for !in.IsDelim('}') { 231 key := in.UnsafeFieldName(false) 232 in.WantColon() 233 if in.IsNull() { 234 in.Skip() 235 in.WantComma() 236 continue 237 } 238 switch key { 239 case "flag": 240 out.Flag = string(in.String()) 241 case "quantity": 242 out.Quantity = int32(in.Int32()) 243 case "type_id": 244 out.TypeId = int32(in.Int32()) 245 default: 246 in.SkipRecursive() 247 } 248 in.WantComma() 249 } 250 in.Delim('}') 251 if isTopLevel { 252 in.Consumed() 253 } 254 } 255 func easyjsonC29a6102EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in PostCharactersCharacterIdFittingsItem) { 256 out.RawByte('{') 257 first := true 258 _ = first 259 if in.Flag != "" { 260 const prefix string = ",\"flag\":" 261 first = false 262 out.RawString(prefix[1:]) 263 out.String(string(in.Flag)) 264 } 265 if in.Quantity != 0 { 266 const prefix string = ",\"quantity\":" 267 if first { 268 first = false 269 out.RawString(prefix[1:]) 270 } else { 271 out.RawString(prefix) 272 } 273 out.Int32(int32(in.Quantity)) 274 } 275 if in.TypeId != 0 { 276 const prefix string = ",\"type_id\":" 277 if first { 278 first = false 279 out.RawString(prefix[1:]) 280 } else { 281 out.RawString(prefix) 282 } 283 out.Int32(int32(in.TypeId)) 284 } 285 out.RawByte('}') 286 }