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