github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_contracts_public_region_id_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 easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetContractsPublicRegionId200OkList) { 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(GetContractsPublicRegionId200OkList, 0, 0) 31 } else { 32 *out = GetContractsPublicRegionId200OkList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetContractsPublicRegionId200Ok 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 easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetContractsPublicRegionId200OkList) { 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 GetContractsPublicRegionId200OkList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetContractsPublicRegionId200OkList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetContractsPublicRegionId200OkList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetContractsPublicRegionId200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetContractsPublicRegionId200Ok) { 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 "buyout": 107 out.Buyout = float64(in.Float64()) 108 case "collateral": 109 out.Collateral = float64(in.Float64()) 110 case "contract_id": 111 out.ContractId = int32(in.Int32()) 112 case "date_expired": 113 if data := in.Raw(); in.Ok() { 114 in.AddError((out.DateExpired).UnmarshalJSON(data)) 115 } 116 case "date_issued": 117 if data := in.Raw(); in.Ok() { 118 in.AddError((out.DateIssued).UnmarshalJSON(data)) 119 } 120 case "days_to_complete": 121 out.DaysToComplete = int32(in.Int32()) 122 case "end_location_id": 123 out.EndLocationId = int64(in.Int64()) 124 case "for_corporation": 125 out.ForCorporation = bool(in.Bool()) 126 case "issuer_corporation_id": 127 out.IssuerCorporationId = int32(in.Int32()) 128 case "issuer_id": 129 out.IssuerId = int32(in.Int32()) 130 case "price": 131 out.Price = float64(in.Float64()) 132 case "reward": 133 out.Reward = float64(in.Float64()) 134 case "start_location_id": 135 out.StartLocationId = int64(in.Int64()) 136 case "title": 137 out.Title = string(in.String()) 138 case "type": 139 out.Type_ = string(in.String()) 140 case "volume": 141 out.Volume = float64(in.Float64()) 142 default: 143 in.SkipRecursive() 144 } 145 in.WantComma() 146 } 147 in.Delim('}') 148 if isTopLevel { 149 in.Consumed() 150 } 151 } 152 func easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetContractsPublicRegionId200Ok) { 153 out.RawByte('{') 154 first := true 155 _ = first 156 if in.Buyout != 0 { 157 const prefix string = ",\"buyout\":" 158 first = false 159 out.RawString(prefix[1:]) 160 out.Float64(float64(in.Buyout)) 161 } 162 if in.Collateral != 0 { 163 const prefix string = ",\"collateral\":" 164 if first { 165 first = false 166 out.RawString(prefix[1:]) 167 } else { 168 out.RawString(prefix) 169 } 170 out.Float64(float64(in.Collateral)) 171 } 172 if in.ContractId != 0 { 173 const prefix string = ",\"contract_id\":" 174 if first { 175 first = false 176 out.RawString(prefix[1:]) 177 } else { 178 out.RawString(prefix) 179 } 180 out.Int32(int32(in.ContractId)) 181 } 182 if true { 183 const prefix string = ",\"date_expired\":" 184 if first { 185 first = false 186 out.RawString(prefix[1:]) 187 } else { 188 out.RawString(prefix) 189 } 190 out.Raw((in.DateExpired).MarshalJSON()) 191 } 192 if true { 193 const prefix string = ",\"date_issued\":" 194 if first { 195 first = false 196 out.RawString(prefix[1:]) 197 } else { 198 out.RawString(prefix) 199 } 200 out.Raw((in.DateIssued).MarshalJSON()) 201 } 202 if in.DaysToComplete != 0 { 203 const prefix string = ",\"days_to_complete\":" 204 if first { 205 first = false 206 out.RawString(prefix[1:]) 207 } else { 208 out.RawString(prefix) 209 } 210 out.Int32(int32(in.DaysToComplete)) 211 } 212 if in.EndLocationId != 0 { 213 const prefix string = ",\"end_location_id\":" 214 if first { 215 first = false 216 out.RawString(prefix[1:]) 217 } else { 218 out.RawString(prefix) 219 } 220 out.Int64(int64(in.EndLocationId)) 221 } 222 if in.ForCorporation { 223 const prefix string = ",\"for_corporation\":" 224 if first { 225 first = false 226 out.RawString(prefix[1:]) 227 } else { 228 out.RawString(prefix) 229 } 230 out.Bool(bool(in.ForCorporation)) 231 } 232 if in.IssuerCorporationId != 0 { 233 const prefix string = ",\"issuer_corporation_id\":" 234 if first { 235 first = false 236 out.RawString(prefix[1:]) 237 } else { 238 out.RawString(prefix) 239 } 240 out.Int32(int32(in.IssuerCorporationId)) 241 } 242 if in.IssuerId != 0 { 243 const prefix string = ",\"issuer_id\":" 244 if first { 245 first = false 246 out.RawString(prefix[1:]) 247 } else { 248 out.RawString(prefix) 249 } 250 out.Int32(int32(in.IssuerId)) 251 } 252 if in.Price != 0 { 253 const prefix string = ",\"price\":" 254 if first { 255 first = false 256 out.RawString(prefix[1:]) 257 } else { 258 out.RawString(prefix) 259 } 260 out.Float64(float64(in.Price)) 261 } 262 if in.Reward != 0 { 263 const prefix string = ",\"reward\":" 264 if first { 265 first = false 266 out.RawString(prefix[1:]) 267 } else { 268 out.RawString(prefix) 269 } 270 out.Float64(float64(in.Reward)) 271 } 272 if in.StartLocationId != 0 { 273 const prefix string = ",\"start_location_id\":" 274 if first { 275 first = false 276 out.RawString(prefix[1:]) 277 } else { 278 out.RawString(prefix) 279 } 280 out.Int64(int64(in.StartLocationId)) 281 } 282 if in.Title != "" { 283 const prefix string = ",\"title\":" 284 if first { 285 first = false 286 out.RawString(prefix[1:]) 287 } else { 288 out.RawString(prefix) 289 } 290 out.String(string(in.Title)) 291 } 292 if in.Type_ != "" { 293 const prefix string = ",\"type\":" 294 if first { 295 first = false 296 out.RawString(prefix[1:]) 297 } else { 298 out.RawString(prefix) 299 } 300 out.String(string(in.Type_)) 301 } 302 if in.Volume != 0 { 303 const prefix string = ",\"volume\":" 304 if first { 305 first = false 306 out.RawString(prefix[1:]) 307 } else { 308 out.RawString(prefix) 309 } 310 out.Float64(float64(in.Volume)) 311 } 312 out.RawByte('}') 313 } 314 315 // MarshalJSON supports json.Marshaler interface 316 func (v GetContractsPublicRegionId200Ok) MarshalJSON() ([]byte, error) { 317 w := jwriter.Writer{} 318 easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi1(&w, v) 319 return w.Buffer.BuildBytes(), w.Error 320 } 321 322 // MarshalEasyJSON supports easyjson.Marshaler interface 323 func (v GetContractsPublicRegionId200Ok) MarshalEasyJSON(w *jwriter.Writer) { 324 easyjsonE838f8a7EncodeGithubComAntihaxGoesiEsi1(w, v) 325 } 326 327 // UnmarshalJSON supports json.Unmarshaler interface 328 func (v *GetContractsPublicRegionId200Ok) UnmarshalJSON(data []byte) error { 329 r := jlexer.Lexer{Data: data} 330 easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi1(&r, v) 331 return r.Error() 332 } 333 334 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 335 func (v *GetContractsPublicRegionId200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) { 336 easyjsonE838f8a7DecodeGithubComAntihaxGoesiEsi1(l, v) 337 }