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