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