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