github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_killmails_killmail_id_killmail_hash_item_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 easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashItemList) { 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(GetKillmailsKillmailIdKillmailHashItemList, 0, 1) 31 } else { 32 *out = GetKillmailsKillmailIdKillmailHashItemList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetKillmailsKillmailIdKillmailHashItem 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 easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashItemList) { 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 GetKillmailsKillmailIdKillmailHashItemList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetKillmailsKillmailIdKillmailHashItemList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetKillmailsKillmailIdKillmailHashItemList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetKillmailsKillmailIdKillmailHashItemList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashItem) { 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 "flag": 107 out.Flag = int32(in.Int32()) 108 case "item_type_id": 109 out.ItemTypeId = 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([]GetKillmailsKillmailIdKillmailHashItemsItem, 0, 2) 119 } else { 120 out.Items = []GetKillmailsKillmailIdKillmailHashItemsItem{} 121 } 122 } else { 123 out.Items = (out.Items)[:0] 124 } 125 for !in.IsDelim(']') { 126 var v4 GetKillmailsKillmailIdKillmailHashItemsItem 127 (v4).UnmarshalEasyJSON(in) 128 out.Items = append(out.Items, v4) 129 in.WantComma() 130 } 131 in.Delim(']') 132 } 133 case "quantity_destroyed": 134 out.QuantityDestroyed = int64(in.Int64()) 135 case "quantity_dropped": 136 out.QuantityDropped = int64(in.Int64()) 137 case "singleton": 138 out.Singleton = int32(in.Int32()) 139 default: 140 in.SkipRecursive() 141 } 142 in.WantComma() 143 } 144 in.Delim('}') 145 if isTopLevel { 146 in.Consumed() 147 } 148 } 149 func easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashItem) { 150 out.RawByte('{') 151 first := true 152 _ = first 153 if in.Flag != 0 { 154 const prefix string = ",\"flag\":" 155 first = false 156 out.RawString(prefix[1:]) 157 out.Int32(int32(in.Flag)) 158 } 159 if in.ItemTypeId != 0 { 160 const prefix string = ",\"item_type_id\":" 161 if first { 162 first = false 163 out.RawString(prefix[1:]) 164 } else { 165 out.RawString(prefix) 166 } 167 out.Int32(int32(in.ItemTypeId)) 168 } 169 if len(in.Items) != 0 { 170 const prefix string = ",\"items\":" 171 if first { 172 first = false 173 out.RawString(prefix[1:]) 174 } else { 175 out.RawString(prefix) 176 } 177 { 178 out.RawByte('[') 179 for v5, v6 := range in.Items { 180 if v5 > 0 { 181 out.RawByte(',') 182 } 183 (v6).MarshalEasyJSON(out) 184 } 185 out.RawByte(']') 186 } 187 } 188 if in.QuantityDestroyed != 0 { 189 const prefix string = ",\"quantity_destroyed\":" 190 if first { 191 first = false 192 out.RawString(prefix[1:]) 193 } else { 194 out.RawString(prefix) 195 } 196 out.Int64(int64(in.QuantityDestroyed)) 197 } 198 if in.QuantityDropped != 0 { 199 const prefix string = ",\"quantity_dropped\":" 200 if first { 201 first = false 202 out.RawString(prefix[1:]) 203 } else { 204 out.RawString(prefix) 205 } 206 out.Int64(int64(in.QuantityDropped)) 207 } 208 if in.Singleton != 0 { 209 const prefix string = ",\"singleton\":" 210 if first { 211 first = false 212 out.RawString(prefix[1:]) 213 } else { 214 out.RawString(prefix) 215 } 216 out.Int32(int32(in.Singleton)) 217 } 218 out.RawByte('}') 219 } 220 221 // MarshalJSON supports json.Marshaler interface 222 func (v GetKillmailsKillmailIdKillmailHashItem) MarshalJSON() ([]byte, error) { 223 w := jwriter.Writer{} 224 easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi1(&w, v) 225 return w.Buffer.BuildBytes(), w.Error 226 } 227 228 // MarshalEasyJSON supports easyjson.Marshaler interface 229 func (v GetKillmailsKillmailIdKillmailHashItem) MarshalEasyJSON(w *jwriter.Writer) { 230 easyjson3bbccc1aEncodeGithubComAntihaxGoesiEsi1(w, v) 231 } 232 233 // UnmarshalJSON supports json.Unmarshaler interface 234 func (v *GetKillmailsKillmailIdKillmailHashItem) UnmarshalJSON(data []byte) error { 235 r := jlexer.Lexer{Data: data} 236 easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi1(&r, v) 237 return r.Error() 238 } 239 240 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 241 func (v *GetKillmailsKillmailIdKillmailHashItem) UnmarshalEasyJSON(l *jlexer.Lexer) { 242 easyjson3bbccc1aDecodeGithubComAntihaxGoesiEsi1(l, v) 243 }