github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_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 easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdOkList) { 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(GetCharactersCharacterIdOkList, 0, 0) 31 } else { 32 *out = GetCharactersCharacterIdOkList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetCharactersCharacterIdOk 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 easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdOkList) { 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 GetCharactersCharacterIdOkList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetCharactersCharacterIdOkList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetCharactersCharacterIdOkList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetCharactersCharacterIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdOk) { 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 "alliance_id": 107 out.AllianceId = int32(in.Int32()) 108 case "birthday": 109 if data := in.Raw(); in.Ok() { 110 in.AddError((out.Birthday).UnmarshalJSON(data)) 111 } 112 case "bloodline_id": 113 out.BloodlineId = int32(in.Int32()) 114 case "corporation_id": 115 out.CorporationId = int32(in.Int32()) 116 case "description": 117 out.Description = string(in.String()) 118 case "faction_id": 119 out.FactionId = int32(in.Int32()) 120 case "gender": 121 out.Gender = string(in.String()) 122 case "name": 123 out.Name = string(in.String()) 124 case "race_id": 125 out.RaceId = int32(in.Int32()) 126 case "security_status": 127 out.SecurityStatus = float32(in.Float32()) 128 case "title": 129 out.Title = string(in.String()) 130 default: 131 in.SkipRecursive() 132 } 133 in.WantComma() 134 } 135 in.Delim('}') 136 if isTopLevel { 137 in.Consumed() 138 } 139 } 140 func easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdOk) { 141 out.RawByte('{') 142 first := true 143 _ = first 144 if in.AllianceId != 0 { 145 const prefix string = ",\"alliance_id\":" 146 first = false 147 out.RawString(prefix[1:]) 148 out.Int32(int32(in.AllianceId)) 149 } 150 if true { 151 const prefix string = ",\"birthday\":" 152 if first { 153 first = false 154 out.RawString(prefix[1:]) 155 } else { 156 out.RawString(prefix) 157 } 158 out.Raw((in.Birthday).MarshalJSON()) 159 } 160 if in.BloodlineId != 0 { 161 const prefix string = ",\"bloodline_id\":" 162 if first { 163 first = false 164 out.RawString(prefix[1:]) 165 } else { 166 out.RawString(prefix) 167 } 168 out.Int32(int32(in.BloodlineId)) 169 } 170 if in.CorporationId != 0 { 171 const prefix string = ",\"corporation_id\":" 172 if first { 173 first = false 174 out.RawString(prefix[1:]) 175 } else { 176 out.RawString(prefix) 177 } 178 out.Int32(int32(in.CorporationId)) 179 } 180 if in.Description != "" { 181 const prefix string = ",\"description\":" 182 if first { 183 first = false 184 out.RawString(prefix[1:]) 185 } else { 186 out.RawString(prefix) 187 } 188 out.String(string(in.Description)) 189 } 190 if in.FactionId != 0 { 191 const prefix string = ",\"faction_id\":" 192 if first { 193 first = false 194 out.RawString(prefix[1:]) 195 } else { 196 out.RawString(prefix) 197 } 198 out.Int32(int32(in.FactionId)) 199 } 200 if in.Gender != "" { 201 const prefix string = ",\"gender\":" 202 if first { 203 first = false 204 out.RawString(prefix[1:]) 205 } else { 206 out.RawString(prefix) 207 } 208 out.String(string(in.Gender)) 209 } 210 if in.Name != "" { 211 const prefix string = ",\"name\":" 212 if first { 213 first = false 214 out.RawString(prefix[1:]) 215 } else { 216 out.RawString(prefix) 217 } 218 out.String(string(in.Name)) 219 } 220 if in.RaceId != 0 { 221 const prefix string = ",\"race_id\":" 222 if first { 223 first = false 224 out.RawString(prefix[1:]) 225 } else { 226 out.RawString(prefix) 227 } 228 out.Int32(int32(in.RaceId)) 229 } 230 if in.SecurityStatus != 0 { 231 const prefix string = ",\"security_status\":" 232 if first { 233 first = false 234 out.RawString(prefix[1:]) 235 } else { 236 out.RawString(prefix) 237 } 238 out.Float32(float32(in.SecurityStatus)) 239 } 240 if in.Title != "" { 241 const prefix string = ",\"title\":" 242 if first { 243 first = false 244 out.RawString(prefix[1:]) 245 } else { 246 out.RawString(prefix) 247 } 248 out.String(string(in.Title)) 249 } 250 out.RawByte('}') 251 } 252 253 // MarshalJSON supports json.Marshaler interface 254 func (v GetCharactersCharacterIdOk) MarshalJSON() ([]byte, error) { 255 w := jwriter.Writer{} 256 easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi1(&w, v) 257 return w.Buffer.BuildBytes(), w.Error 258 } 259 260 // MarshalEasyJSON supports easyjson.Marshaler interface 261 func (v GetCharactersCharacterIdOk) MarshalEasyJSON(w *jwriter.Writer) { 262 easyjsonD2c9dba0EncodeGithubComAntihaxGoesiEsi1(w, v) 263 } 264 265 // UnmarshalJSON supports json.Unmarshaler interface 266 func (v *GetCharactersCharacterIdOk) UnmarshalJSON(data []byte) error { 267 r := jlexer.Lexer{Data: data} 268 easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi1(&r, v) 269 return r.Error() 270 } 271 272 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 273 func (v *GetCharactersCharacterIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) { 274 easyjsonD2c9dba0DecodeGithubComAntihaxGoesiEsi1(l, v) 275 }