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