629 lines
12 KiB
Plaintext
629 lines
12 KiB
Plaintext
|
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
|
||
|
|
||
|
package common
|
||
|
|
||
|
import (
|
||
|
json "encoding/json"
|
||
|
easyjson "github.com/mailru/easyjson"
|
||
|
jlexer "github.com/mailru/easyjson/jlexer"
|
||
|
jwriter "github.com/mailru/easyjson/jwriter"
|
||
|
)
|
||
|
|
||
|
// suppress unused package warning
|
||
|
var (
|
||
|
_ *json.RawMessage
|
||
|
_ *jlexer.Lexer
|
||
|
_ *jwriter.Writer
|
||
|
_ easyjson.Marshaler
|
||
|
)
|
||
|
|
||
|
func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(in *jlexer.Lexer, out *WsTopicList) {
|
||
|
isTopLevel := in.IsStart()
|
||
|
if in.IsNull() {
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
in.Skip()
|
||
|
return
|
||
|
}
|
||
|
in.Delim('{')
|
||
|
for !in.IsDelim('}') {
|
||
|
key := in.UnsafeString()
|
||
|
in.WantColon()
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
in.WantComma()
|
||
|
continue
|
||
|
}
|
||
|
switch key {
|
||
|
case "Topics":
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
out.Topics = nil
|
||
|
} else {
|
||
|
in.Delim('[')
|
||
|
if out.Topics == nil {
|
||
|
if !in.IsDelim(']') {
|
||
|
out.Topics = make([]*WsTopicsRow, 0, 8)
|
||
|
} else {
|
||
|
out.Topics = []*WsTopicsRow{}
|
||
|
}
|
||
|
} else {
|
||
|
out.Topics = (out.Topics)[:0]
|
||
|
}
|
||
|
for !in.IsDelim(']') {
|
||
|
var v1 *WsTopicsRow
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
v1 = nil
|
||
|
} else {
|
||
|
if v1 == nil {
|
||
|
v1 = new(WsTopicsRow)
|
||
|
}
|
||
|
easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon1(in, v1)
|
||
|
}
|
||
|
out.Topics = append(out.Topics, v1)
|
||
|
in.WantComma()
|
||
|
}
|
||
|
in.Delim(']')
|
||
|
}
|
||
|
case "LastPage":
|
||
|
out.LastPage = int(in.Int())
|
||
|
case "LastUpdate":
|
||
|
out.LastUpdate = int64(in.Int64())
|
||
|
default:
|
||
|
in.SkipRecursive()
|
||
|
}
|
||
|
in.WantComma()
|
||
|
}
|
||
|
in.Delim('}')
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
}
|
||
|
func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(out *jwriter.Writer, in WsTopicList) {
|
||
|
out.RawByte('{')
|
||
|
first := true
|
||
|
_ = first
|
||
|
{
|
||
|
const prefix string = ",\"Topics\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
if in.Topics == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||
|
out.RawString("null")
|
||
|
} else {
|
||
|
out.RawByte('[')
|
||
|
for v2, v3 := range in.Topics {
|
||
|
if v2 > 0 {
|
||
|
out.RawByte(',')
|
||
|
}
|
||
|
if v3 == nil {
|
||
|
out.RawString("null")
|
||
|
} else {
|
||
|
easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon1(out, *v3)
|
||
|
}
|
||
|
}
|
||
|
out.RawByte(']')
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastPage\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.LastPage))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastUpdate\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int64(int64(in.LastUpdate))
|
||
|
}
|
||
|
out.RawByte('}')
|
||
|
}
|
||
|
|
||
|
// MarshalJSON supports json.Marshaler interface
|
||
|
func (v WsTopicList) MarshalJSON() ([]byte, error) {
|
||
|
w := jwriter.Writer{}
|
||
|
easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(&w, v)
|
||
|
return w.Buffer.BuildBytes(), w.Error
|
||
|
}
|
||
|
|
||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||
|
func (v WsTopicList) MarshalEasyJSON(w *jwriter.Writer) {
|
||
|
easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon(w, v)
|
||
|
}
|
||
|
|
||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||
|
func (v *WsTopicList) UnmarshalJSON(data []byte) error {
|
||
|
r := jlexer.Lexer{Data: data}
|
||
|
easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(&r, v)
|
||
|
return r.Error()
|
||
|
}
|
||
|
|
||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||
|
func (v *WsTopicList) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||
|
easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon(l, v)
|
||
|
}
|
||
|
func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon1(in *jlexer.Lexer, out *WsTopicsRow) {
|
||
|
isTopLevel := in.IsStart()
|
||
|
if in.IsNull() {
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
in.Skip()
|
||
|
return
|
||
|
}
|
||
|
in.Delim('{')
|
||
|
for !in.IsDelim('}') {
|
||
|
key := in.UnsafeString()
|
||
|
in.WantColon()
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
in.WantComma()
|
||
|
continue
|
||
|
}
|
||
|
switch key {
|
||
|
case "ID":
|
||
|
out.ID = int(in.Int())
|
||
|
case "Link":
|
||
|
out.Link = string(in.String())
|
||
|
case "Title":
|
||
|
out.Title = string(in.String())
|
||
|
case "CreatedBy":
|
||
|
out.CreatedBy = int(in.Int())
|
||
|
case "IsClosed":
|
||
|
out.IsClosed = bool(in.Bool())
|
||
|
case "Sticky":
|
||
|
out.Sticky = bool(in.Bool())
|
||
|
case "CreatedAt":
|
||
|
if data := in.Raw(); in.Ok() {
|
||
|
in.AddError((out.CreatedAt).UnmarshalJSON(data))
|
||
|
}
|
||
|
case "LastReplyAt":
|
||
|
if data := in.Raw(); in.Ok() {
|
||
|
in.AddError((out.LastReplyAt).UnmarshalJSON(data))
|
||
|
}
|
||
|
case "RelativeLastReplyAt":
|
||
|
out.RelativeLastReplyAt = string(in.String())
|
||
|
case "LastReplyBy":
|
||
|
out.LastReplyBy = int(in.Int())
|
||
|
case "LastReplyID":
|
||
|
out.LastReplyID = int(in.Int())
|
||
|
case "ParentID":
|
||
|
out.ParentID = int(in.Int())
|
||
|
case "ViewCount":
|
||
|
out.ViewCount = int64(in.Int64())
|
||
|
case "PostCount":
|
||
|
out.PostCount = int(in.Int())
|
||
|
case "LikeCount":
|
||
|
out.LikeCount = int(in.Int())
|
||
|
case "AttachCount":
|
||
|
out.AttachCount = int(in.Int())
|
||
|
case "ClassName":
|
||
|
out.ClassName = string(in.String())
|
||
|
case "Creator":
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
out.Creator = nil
|
||
|
} else {
|
||
|
if out.Creator == nil {
|
||
|
out.Creator = new(WsJSONUser)
|
||
|
}
|
||
|
easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in, out.Creator)
|
||
|
}
|
||
|
case "LastUser":
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
out.LastUser = nil
|
||
|
} else {
|
||
|
if out.LastUser == nil {
|
||
|
out.LastUser = new(WsJSONUser)
|
||
|
}
|
||
|
easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in, out.LastUser)
|
||
|
}
|
||
|
case "ForumName":
|
||
|
out.ForumName = string(in.String())
|
||
|
case "ForumLink":
|
||
|
out.ForumLink = string(in.String())
|
||
|
default:
|
||
|
in.SkipRecursive()
|
||
|
}
|
||
|
in.WantComma()
|
||
|
}
|
||
|
in.Delim('}')
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
}
|
||
|
func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon1(out *jwriter.Writer, in WsTopicsRow) {
|
||
|
out.RawByte('{')
|
||
|
first := true
|
||
|
_ = first
|
||
|
{
|
||
|
const prefix string = ",\"ID\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.ID))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Link\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.Link))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Title\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.Title))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"CreatedBy\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.CreatedBy))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"IsClosed\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Bool(bool(in.IsClosed))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Sticky\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Bool(bool(in.Sticky))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"CreatedAt\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Raw((in.CreatedAt).MarshalJSON())
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastReplyAt\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Raw((in.LastReplyAt).MarshalJSON())
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"RelativeLastReplyAt\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.RelativeLastReplyAt))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastReplyBy\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.LastReplyBy))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastReplyID\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.LastReplyID))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"ParentID\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.ParentID))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"ViewCount\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int64(int64(in.ViewCount))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"PostCount\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.PostCount))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LikeCount\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.LikeCount))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"AttachCount\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.AttachCount))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"ClassName\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.ClassName))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Creator\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
if in.Creator == nil {
|
||
|
out.RawString("null")
|
||
|
} else {
|
||
|
easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out, *in.Creator)
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"LastUser\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
if in.LastUser == nil {
|
||
|
out.RawString("null")
|
||
|
} else {
|
||
|
easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out, *in.LastUser)
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"ForumName\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.ForumName))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"ForumLink\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.ForumLink))
|
||
|
}
|
||
|
out.RawByte('}')
|
||
|
}
|
||
|
func easyjsonC803d3e7DecodeGithubComAzarealGosoraCommon2(in *jlexer.Lexer, out *WsJSONUser) {
|
||
|
isTopLevel := in.IsStart()
|
||
|
if in.IsNull() {
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
in.Skip()
|
||
|
return
|
||
|
}
|
||
|
in.Delim('{')
|
||
|
for !in.IsDelim('}') {
|
||
|
key := in.UnsafeString()
|
||
|
in.WantColon()
|
||
|
if in.IsNull() {
|
||
|
in.Skip()
|
||
|
in.WantComma()
|
||
|
continue
|
||
|
}
|
||
|
switch key {
|
||
|
case "ID":
|
||
|
out.ID = int(in.Int())
|
||
|
case "Link":
|
||
|
out.Link = string(in.String())
|
||
|
case "Name":
|
||
|
out.Name = string(in.String())
|
||
|
case "Group":
|
||
|
out.Group = int(in.Int())
|
||
|
case "IsMod":
|
||
|
out.IsMod = bool(in.Bool())
|
||
|
case "Avatar":
|
||
|
out.Avatar = string(in.String())
|
||
|
case "MicroAvatar":
|
||
|
out.MicroAvatar = string(in.String())
|
||
|
case "Level":
|
||
|
out.Level = int(in.Int())
|
||
|
case "Score":
|
||
|
out.Score = int(in.Int())
|
||
|
case "Liked":
|
||
|
out.Liked = int(in.Int())
|
||
|
default:
|
||
|
in.SkipRecursive()
|
||
|
}
|
||
|
in.WantComma()
|
||
|
}
|
||
|
in.Delim('}')
|
||
|
if isTopLevel {
|
||
|
in.Consumed()
|
||
|
}
|
||
|
}
|
||
|
func easyjsonC803d3e7EncodeGithubComAzarealGosoraCommon2(out *jwriter.Writer, in WsJSONUser) {
|
||
|
out.RawByte('{')
|
||
|
first := true
|
||
|
_ = first
|
||
|
{
|
||
|
const prefix string = ",\"ID\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.ID))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Link\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.Link))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Name\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.Name))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Group\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.Group))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"IsMod\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Bool(bool(in.IsMod))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Avatar\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.Avatar))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"MicroAvatar\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.String(string(in.MicroAvatar))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Level\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.Level))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Score\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.Score))
|
||
|
}
|
||
|
{
|
||
|
const prefix string = ",\"Liked\":"
|
||
|
if first {
|
||
|
first = false
|
||
|
out.RawString(prefix[1:])
|
||
|
} else {
|
||
|
out.RawString(prefix)
|
||
|
}
|
||
|
out.Int(int(in.Liked))
|
||
|
}
|
||
|
out.RawByte('}')
|
||
|
}
|