models/clan_easyjson.go
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package models
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 easyjson91eb9988DecodeGithubComTopfreegamesKhanModels(in *jlexer.Lexer, out *Clan) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "id":
out.ID = int64(in.Int64())
case "gameId":
out.GameID = string(in.String())
case "publicId":
out.PublicID = string(in.String())
case "name":
out.Name = string(in.String())
case "ownerId":
out.OwnerID = int64(in.Int64())
case "membershipCount":
out.MembershipCount = int(in.Int())
case "metadata":
if in.IsNull() {
in.Skip()
} else {
in.Delim('{')
out.Metadata = make(map[string]interface{})
for !in.IsDelim('}') {
key := string(in.String())
in.WantColon()
var v1 interface{}
if m, ok := v1.(easyjson.Unmarshaler); ok {
m.UnmarshalEasyJSON(in)
} else if m, ok := v1.(json.Unmarshaler); ok {
_ = m.UnmarshalJSON(in.Raw())
} else {
v1 = in.Interface()
}
(out.Metadata)[key] = v1
in.WantComma()
}
in.Delim('}')
}
case "allowApplication":
out.AllowApplication = bool(in.Bool())
case "autoJoin":
out.AutoJoin = bool(in.Bool())
case "createdAt":
out.CreatedAt = int64(in.Int64())
case "updatedAt":
out.UpdatedAt = int64(in.Int64())
case "deletedAt":
out.DeletedAt = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson91eb9988EncodeGithubComTopfreegamesKhanModels(out *jwriter.Writer, in Clan) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"id\":"
out.RawString(prefix[1:])
out.Int64(int64(in.ID))
}
{
const prefix string = ",\"gameId\":"
out.RawString(prefix)
out.String(string(in.GameID))
}
{
const prefix string = ",\"publicId\":"
out.RawString(prefix)
out.String(string(in.PublicID))
}
{
const prefix string = ",\"name\":"
out.RawString(prefix)
out.String(string(in.Name))
}
{
const prefix string = ",\"ownerId\":"
out.RawString(prefix)
out.Int64(int64(in.OwnerID))
}
{
const prefix string = ",\"membershipCount\":"
out.RawString(prefix)
out.Int(int(in.MembershipCount))
}
{
const prefix string = ",\"metadata\":"
out.RawString(prefix)
if in.Metadata == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in.Metadata {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
if m, ok := v2Value.(easyjson.Marshaler); ok {
m.MarshalEasyJSON(out)
} else if m, ok := v2Value.(json.Marshaler); ok {
out.Raw(m.MarshalJSON())
} else {
out.Raw(json.Marshal(v2Value))
}
}
out.RawByte('}')
}
}
{
const prefix string = ",\"allowApplication\":"
out.RawString(prefix)
out.Bool(bool(in.AllowApplication))
}
{
const prefix string = ",\"autoJoin\":"
out.RawString(prefix)
out.Bool(bool(in.AutoJoin))
}
{
const prefix string = ",\"createdAt\":"
out.RawString(prefix)
out.Int64(int64(in.CreatedAt))
}
{
const prefix string = ",\"updatedAt\":"
out.RawString(prefix)
out.Int64(int64(in.UpdatedAt))
}
{
const prefix string = ",\"deletedAt\":"
out.RawString(prefix)
out.Int64(int64(in.DeletedAt))
}
out.RawByte('}')
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Clan) MarshalEasyJSON(w *jwriter.Writer) {
easyjson91eb9988EncodeGithubComTopfreegamesKhanModels(w, v)
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Clan) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson91eb9988DecodeGithubComTopfreegamesKhanModels(l, v)
}