github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/common/common_easyjson.tgo (about) 1 // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. 2 3 package common 4 5 import ( 6 json "encoding/json" 7 easyjson "github.com/mailru/easyjson" 8 jlexer "github.com/mailru/easyjson/jlexer" 9 jwriter "github.com/mailru/easyjson/jwriter" 10 ) 11 12 // suppress unused package warning 13 var ( 14 _ *json.RawMessage 15 _ *jlexer.Lexer 16 _ *jwriter.Writer 17 _ easyjson.Marshaler 18 ) 19 20 func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(in *jlexer.Lexer, out *WsTopicList) { 21 isTopLevel := in.IsStart() 22 if in.IsNull() { 23 if isTopLevel { 24 in.Consumed() 25 } 26 in.Skip() 27 return 28 } 29 in.Delim('{') 30 for !in.IsDelim('}') { 31 key := in.UnsafeString() 32 in.WantColon() 33 if in.IsNull() { 34 in.Skip() 35 in.WantComma() 36 continue 37 } 38 switch key { 39 case "Topics": 40 if in.IsNull() { 41 in.Skip() 42 out.Topics = nil 43 } else { 44 in.Delim('[') 45 if out.Topics == nil { 46 if !in.IsDelim(']') { 47 out.Topics = make([]*WsTopicsRow, 0, 8) 48 } else { 49 out.Topics = []*WsTopicsRow{} 50 } 51 } else { 52 out.Topics = (out.Topics)[:0] 53 } 54 for !in.IsDelim(']') { 55 var v1 *WsTopicsRow 56 if in.IsNull() { 57 in.Skip() 58 v1 = nil 59 } else { 60 if v1 == nil { 61 v1 = new(WsTopicsRow) 62 } 63 easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon1(in, v1) 64 } 65 out.Topics = append(out.Topics, v1) 66 in.WantComma() 67 } 68 in.Delim(']') 69 } 70 case "LastPage": 71 out.LastPage = int(in.Int()) 72 case "LastUpdate": 73 out.LastUpdate = int64(in.Int64()) 74 default: 75 in.SkipRecursive() 76 } 77 in.WantComma() 78 } 79 in.Delim('}') 80 if isTopLevel { 81 in.Consumed() 82 } 83 } 84 func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(out *jwriter.Writer, in WsTopicList) { 85 out.RawByte('{') 86 first := true 87 _ = first 88 { 89 const prefix string = ",\"Topics\":" 90 if first { 91 first = false 92 out.RawString(prefix[1:]) 93 } else { 94 out.RawString(prefix) 95 } 96 if in.Topics == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { 97 out.RawString("null") 98 } else { 99 out.RawByte('[') 100 for v2, v3 := range in.Topics { 101 if v2 > 0 { 102 out.RawByte(',') 103 } 104 if v3 == nil { 105 out.RawString("null") 106 } else { 107 easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon1(out, *v3) 108 } 109 } 110 out.RawByte(']') 111 } 112 } 113 { 114 const prefix string = ",\"LastPage\":" 115 if first { 116 first = false 117 out.RawString(prefix[1:]) 118 } else { 119 out.RawString(prefix) 120 } 121 out.Int(int(in.LastPage)) 122 } 123 { 124 const prefix string = ",\"LastUpdate\":" 125 if first { 126 first = false 127 out.RawString(prefix[1:]) 128 } else { 129 out.RawString(prefix) 130 } 131 out.Int64(int64(in.LastUpdate)) 132 } 133 out.RawByte('}') 134 } 135 136 // MarshalJSON supports json.Marshaler interface 137 func (v WsTopicList) MarshalJSON() ([]byte, error) { 138 w := jwriter.Writer{} 139 easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(&w, v) 140 return w.Buffer.BuildBytes(), w.Error 141 } 142 143 // MarshalEasyJSON supports easyjson.Marshaler interface 144 func (v WsTopicList) MarshalEasyJSON(w *jwriter.Writer) { 145 easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(w, v) 146 } 147 148 // UnmarshalJSON supports json.Unmarshaler interface 149 func (v *WsTopicList) UnmarshalJSON(data []byte) error { 150 r := jlexer.Lexer{Data: data} 151 easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(&r, v) 152 return r.Error() 153 } 154 155 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 156 func (v *WsTopicList) UnmarshalEasyJSON(l *jlexer.Lexer) { 157 easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(l, v) 158 } 159 func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon1(in *jlexer.Lexer, out *WsTopicsRow) { 160 isTopLevel := in.IsStart() 161 if in.IsNull() { 162 if isTopLevel { 163 in.Consumed() 164 } 165 in.Skip() 166 return 167 } 168 in.Delim('{') 169 for !in.IsDelim('}') { 170 key := in.UnsafeString() 171 in.WantColon() 172 if in.IsNull() { 173 in.Skip() 174 in.WantComma() 175 continue 176 } 177 switch key { 178 case "ID": 179 out.ID = int(in.Int()) 180 case "Link": 181 out.Link = string(in.String()) 182 case "Title": 183 out.Title = string(in.String()) 184 case "CreatedBy": 185 out.CreatedBy = int(in.Int()) 186 case "IsClosed": 187 out.IsClosed = bool(in.Bool()) 188 case "Sticky": 189 out.Sticky = bool(in.Bool()) 190 case "CreatedAt": 191 if data := in.Raw(); in.Ok() { 192 in.AddError((out.CreatedAt).UnmarshalJSON(data)) 193 } 194 case "LastReplyAt": 195 if data := in.Raw(); in.Ok() { 196 in.AddError((out.LastReplyAt).UnmarshalJSON(data)) 197 } 198 case "RelativeLastReplyAt": 199 out.RelativeLastReplyAt = string(in.String()) 200 case "LastReplyBy": 201 out.LastReplyBy = int(in.Int()) 202 case "LastReplyID": 203 out.LastReplyID = int(in.Int()) 204 case "ParentID": 205 out.ParentID = int(in.Int()) 206 case "ViewCount": 207 out.ViewCount = int64(in.Int64()) 208 case "PostCount": 209 out.PostCount = int(in.Int()) 210 case "LikeCount": 211 out.LikeCount = int(in.Int()) 212 case "AttachCount": 213 out.AttachCount = int(in.Int()) 214 case "ClassName": 215 out.ClassName = string(in.String()) 216 case "Creator": 217 if in.IsNull() { 218 in.Skip() 219 out.Creator = nil 220 } else { 221 if out.Creator == nil { 222 out.Creator = new(WsJSONUser) 223 } 224 easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in, out.Creator) 225 } 226 case "LastUser": 227 if in.IsNull() { 228 in.Skip() 229 out.LastUser = nil 230 } else { 231 if out.LastUser == nil { 232 out.LastUser = new(WsJSONUser) 233 } 234 easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in, out.LastUser) 235 } 236 case "ForumName": 237 out.ForumName = string(in.String()) 238 case "ForumLink": 239 out.ForumLink = string(in.String()) 240 default: 241 in.SkipRecursive() 242 } 243 in.WantComma() 244 } 245 in.Delim('}') 246 if isTopLevel { 247 in.Consumed() 248 } 249 } 250 func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon1(out *jwriter.Writer, in WsTopicsRow) { 251 out.RawByte('{') 252 first := true 253 _ = first 254 { 255 const prefix string = ",\"ID\":" 256 if first { 257 first = false 258 out.RawString(prefix[1:]) 259 } else { 260 out.RawString(prefix) 261 } 262 out.Int(int(in.ID)) 263 } 264 { 265 const prefix string = ",\"Link\":" 266 if first { 267 first = false 268 out.RawString(prefix[1:]) 269 } else { 270 out.RawString(prefix) 271 } 272 out.String(string(in.Link)) 273 } 274 { 275 const prefix string = ",\"Title\":" 276 if first { 277 first = false 278 out.RawString(prefix[1:]) 279 } else { 280 out.RawString(prefix) 281 } 282 out.String(string(in.Title)) 283 } 284 { 285 const prefix string = ",\"CreatedBy\":" 286 if first { 287 first = false 288 out.RawString(prefix[1:]) 289 } else { 290 out.RawString(prefix) 291 } 292 out.Int(int(in.CreatedBy)) 293 } 294 { 295 const prefix string = ",\"IsClosed\":" 296 if first { 297 first = false 298 out.RawString(prefix[1:]) 299 } else { 300 out.RawString(prefix) 301 } 302 out.Bool(bool(in.IsClosed)) 303 } 304 { 305 const prefix string = ",\"Sticky\":" 306 if first { 307 first = false 308 out.RawString(prefix[1:]) 309 } else { 310 out.RawString(prefix) 311 } 312 out.Bool(bool(in.Sticky)) 313 } 314 { 315 const prefix string = ",\"CreatedAt\":" 316 if first { 317 first = false 318 out.RawString(prefix[1:]) 319 } else { 320 out.RawString(prefix) 321 } 322 out.Raw((in.CreatedAt).MarshalJSON()) 323 } 324 { 325 const prefix string = ",\"LastReplyAt\":" 326 if first { 327 first = false 328 out.RawString(prefix[1:]) 329 } else { 330 out.RawString(prefix) 331 } 332 out.Raw((in.LastReplyAt).MarshalJSON()) 333 } 334 { 335 const prefix string = ",\"RelativeLastReplyAt\":" 336 if first { 337 first = false 338 out.RawString(prefix[1:]) 339 } else { 340 out.RawString(prefix) 341 } 342 out.String(string(in.RelativeLastReplyAt)) 343 } 344 { 345 const prefix string = ",\"LastReplyBy\":" 346 if first { 347 first = false 348 out.RawString(prefix[1:]) 349 } else { 350 out.RawString(prefix) 351 } 352 out.Int(int(in.LastReplyBy)) 353 } 354 { 355 const prefix string = ",\"LastReplyID\":" 356 if first { 357 first = false 358 out.RawString(prefix[1:]) 359 } else { 360 out.RawString(prefix) 361 } 362 out.Int(int(in.LastReplyID)) 363 } 364 { 365 const prefix string = ",\"ParentID\":" 366 if first { 367 first = false 368 out.RawString(prefix[1:]) 369 } else { 370 out.RawString(prefix) 371 } 372 out.Int(int(in.ParentID)) 373 } 374 { 375 const prefix string = ",\"ViewCount\":" 376 if first { 377 first = false 378 out.RawString(prefix[1:]) 379 } else { 380 out.RawString(prefix) 381 } 382 out.Int64(int64(in.ViewCount)) 383 } 384 { 385 const prefix string = ",\"PostCount\":" 386 if first { 387 first = false 388 out.RawString(prefix[1:]) 389 } else { 390 out.RawString(prefix) 391 } 392 out.Int(int(in.PostCount)) 393 } 394 { 395 const prefix string = ",\"LikeCount\":" 396 if first { 397 first = false 398 out.RawString(prefix[1:]) 399 } else { 400 out.RawString(prefix) 401 } 402 out.Int(int(in.LikeCount)) 403 } 404 { 405 const prefix string = ",\"AttachCount\":" 406 if first { 407 first = false 408 out.RawString(prefix[1:]) 409 } else { 410 out.RawString(prefix) 411 } 412 out.Int(int(in.AttachCount)) 413 } 414 { 415 const prefix string = ",\"ClassName\":" 416 if first { 417 first = false 418 out.RawString(prefix[1:]) 419 } else { 420 out.RawString(prefix) 421 } 422 out.String(string(in.ClassName)) 423 } 424 { 425 const prefix string = ",\"Creator\":" 426 if first { 427 first = false 428 out.RawString(prefix[1:]) 429 } else { 430 out.RawString(prefix) 431 } 432 if in.Creator == nil { 433 out.RawString("null") 434 } else { 435 easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out, *in.Creator) 436 } 437 } 438 { 439 const prefix string = ",\"LastUser\":" 440 if first { 441 first = false 442 out.RawString(prefix[1:]) 443 } else { 444 out.RawString(prefix) 445 } 446 if in.LastUser == nil { 447 out.RawString("null") 448 } else { 449 easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out, *in.LastUser) 450 } 451 } 452 { 453 const prefix string = ",\"ForumName\":" 454 if first { 455 first = false 456 out.RawString(prefix[1:]) 457 } else { 458 out.RawString(prefix) 459 } 460 out.String(string(in.ForumName)) 461 } 462 { 463 const prefix string = ",\"ForumLink\":" 464 if first { 465 first = false 466 out.RawString(prefix[1:]) 467 } else { 468 out.RawString(prefix) 469 } 470 out.String(string(in.ForumLink)) 471 } 472 out.RawByte('}') 473 } 474 func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in *jlexer.Lexer, out *WsJSONUser) { 475 isTopLevel := in.IsStart() 476 if in.IsNull() { 477 if isTopLevel { 478 in.Consumed() 479 } 480 in.Skip() 481 return 482 } 483 in.Delim('{') 484 for !in.IsDelim('}') { 485 key := in.UnsafeString() 486 in.WantColon() 487 if in.IsNull() { 488 in.Skip() 489 in.WantComma() 490 continue 491 } 492 switch key { 493 case "ID": 494 out.ID = int(in.Int()) 495 case "Link": 496 out.Link = string(in.String()) 497 case "Name": 498 out.Name = string(in.String()) 499 case "Group": 500 out.Group = int(in.Int()) 501 case "IsMod": 502 out.IsMod = bool(in.Bool()) 503 case "Avatar": 504 out.Avatar = string(in.String()) 505 case "MicroAvatar": 506 out.MicroAvatar = string(in.String()) 507 case "Level": 508 out.Level = int(in.Int()) 509 case "Score": 510 out.Score = int(in.Int()) 511 case "Liked": 512 out.Liked = int(in.Int()) 513 default: 514 in.SkipRecursive() 515 } 516 in.WantComma() 517 } 518 in.Delim('}') 519 if isTopLevel { 520 in.Consumed() 521 } 522 } 523 func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out *jwriter.Writer, in WsJSONUser) { 524 out.RawByte('{') 525 first := true 526 _ = first 527 { 528 const prefix string = ",\"ID\":" 529 if first { 530 first = false 531 out.RawString(prefix[1:]) 532 } else { 533 out.RawString(prefix) 534 } 535 out.Int(int(in.ID)) 536 } 537 { 538 const prefix string = ",\"Link\":" 539 if first { 540 first = false 541 out.RawString(prefix[1:]) 542 } else { 543 out.RawString(prefix) 544 } 545 out.String(string(in.Link)) 546 } 547 { 548 const prefix string = ",\"Name\":" 549 if first { 550 first = false 551 out.RawString(prefix[1:]) 552 } else { 553 out.RawString(prefix) 554 } 555 out.String(string(in.Name)) 556 } 557 { 558 const prefix string = ",\"Group\":" 559 if first { 560 first = false 561 out.RawString(prefix[1:]) 562 } else { 563 out.RawString(prefix) 564 } 565 out.Int(int(in.Group)) 566 } 567 { 568 const prefix string = ",\"IsMod\":" 569 if first { 570 first = false 571 out.RawString(prefix[1:]) 572 } else { 573 out.RawString(prefix) 574 } 575 out.Bool(bool(in.IsMod)) 576 } 577 { 578 const prefix string = ",\"Avatar\":" 579 if first { 580 first = false 581 out.RawString(prefix[1:]) 582 } else { 583 out.RawString(prefix) 584 } 585 out.String(string(in.Avatar)) 586 } 587 { 588 const prefix string = ",\"MicroAvatar\":" 589 if first { 590 first = false 591 out.RawString(prefix[1:]) 592 } else { 593 out.RawString(prefix) 594 } 595 out.String(string(in.MicroAvatar)) 596 } 597 { 598 const prefix string = ",\"Level\":" 599 if first { 600 first = false 601 out.RawString(prefix[1:]) 602 } else { 603 out.RawString(prefix) 604 } 605 out.Int(int(in.Level)) 606 } 607 { 608 const prefix string = ",\"Score\":" 609 if first { 610 first = false 611 out.RawString(prefix[1:]) 612 } else { 613 out.RawString(prefix) 614 } 615 out.Int(int(in.Score)) 616 } 617 { 618 const prefix string = ",\"Liked\":" 619 if first { 620 first = false 621 out.RawString(prefix[1:]) 622 } else { 623 out.RawString(prefix) 624 } 625 out.Int(int(in.Liked)) 626 } 627 out.RawByte('}') 628 }