github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_universe_stars_star_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 easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetUniverseStarsStarIdOkList) { 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(GetUniverseStarsStarIdOkList, 0, 0) 31 } else { 32 *out = GetUniverseStarsStarIdOkList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetUniverseStarsStarIdOk 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 easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetUniverseStarsStarIdOkList) { 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 GetUniverseStarsStarIdOkList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetUniverseStarsStarIdOkList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetUniverseStarsStarIdOkList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetUniverseStarsStarIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetUniverseStarsStarIdOk) { 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 "age": 107 out.Age = int64(in.Int64()) 108 case "luminosity": 109 out.Luminosity = float32(in.Float32()) 110 case "name": 111 out.Name = string(in.String()) 112 case "radius": 113 out.Radius = int64(in.Int64()) 114 case "solar_system_id": 115 out.SolarSystemId = int32(in.Int32()) 116 case "spectral_class": 117 out.SpectralClass = string(in.String()) 118 case "temperature": 119 out.Temperature = int32(in.Int32()) 120 case "type_id": 121 out.TypeId = int32(in.Int32()) 122 default: 123 in.SkipRecursive() 124 } 125 in.WantComma() 126 } 127 in.Delim('}') 128 if isTopLevel { 129 in.Consumed() 130 } 131 } 132 func easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetUniverseStarsStarIdOk) { 133 out.RawByte('{') 134 first := true 135 _ = first 136 if in.Age != 0 { 137 const prefix string = ",\"age\":" 138 first = false 139 out.RawString(prefix[1:]) 140 out.Int64(int64(in.Age)) 141 } 142 if in.Luminosity != 0 { 143 const prefix string = ",\"luminosity\":" 144 if first { 145 first = false 146 out.RawString(prefix[1:]) 147 } else { 148 out.RawString(prefix) 149 } 150 out.Float32(float32(in.Luminosity)) 151 } 152 if in.Name != "" { 153 const prefix string = ",\"name\":" 154 if first { 155 first = false 156 out.RawString(prefix[1:]) 157 } else { 158 out.RawString(prefix) 159 } 160 out.String(string(in.Name)) 161 } 162 if in.Radius != 0 { 163 const prefix string = ",\"radius\":" 164 if first { 165 first = false 166 out.RawString(prefix[1:]) 167 } else { 168 out.RawString(prefix) 169 } 170 out.Int64(int64(in.Radius)) 171 } 172 if in.SolarSystemId != 0 { 173 const prefix string = ",\"solar_system_id\":" 174 if first { 175 first = false 176 out.RawString(prefix[1:]) 177 } else { 178 out.RawString(prefix) 179 } 180 out.Int32(int32(in.SolarSystemId)) 181 } 182 if in.SpectralClass != "" { 183 const prefix string = ",\"spectral_class\":" 184 if first { 185 first = false 186 out.RawString(prefix[1:]) 187 } else { 188 out.RawString(prefix) 189 } 190 out.String(string(in.SpectralClass)) 191 } 192 if in.Temperature != 0 { 193 const prefix string = ",\"temperature\":" 194 if first { 195 first = false 196 out.RawString(prefix[1:]) 197 } else { 198 out.RawString(prefix) 199 } 200 out.Int32(int32(in.Temperature)) 201 } 202 if in.TypeId != 0 { 203 const prefix string = ",\"type_id\":" 204 if first { 205 first = false 206 out.RawString(prefix[1:]) 207 } else { 208 out.RawString(prefix) 209 } 210 out.Int32(int32(in.TypeId)) 211 } 212 out.RawByte('}') 213 } 214 215 // MarshalJSON supports json.Marshaler interface 216 func (v GetUniverseStarsStarIdOk) MarshalJSON() ([]byte, error) { 217 w := jwriter.Writer{} 218 easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi1(&w, v) 219 return w.Buffer.BuildBytes(), w.Error 220 } 221 222 // MarshalEasyJSON supports easyjson.Marshaler interface 223 func (v GetUniverseStarsStarIdOk) MarshalEasyJSON(w *jwriter.Writer) { 224 easyjsonFddeaa82EncodeGithubComAntihaxGoesiEsi1(w, v) 225 } 226 227 // UnmarshalJSON supports json.Unmarshaler interface 228 func (v *GetUniverseStarsStarIdOk) UnmarshalJSON(data []byte) error { 229 r := jlexer.Lexer{Data: data} 230 easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi1(&r, v) 231 return r.Error() 232 } 233 234 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 235 func (v *GetUniverseStarsStarIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) { 236 easyjsonFddeaa82DecodeGithubComAntihaxGoesiEsi1(l, v) 237 }