github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_fw_leaderboards_characters_kills_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 easyjsonFa740090DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetFwLeaderboardsCharactersKillsList) {
    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(GetFwLeaderboardsCharactersKillsList, 0, 0)
    31  			} else {
    32  				*out = GetFwLeaderboardsCharactersKillsList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetFwLeaderboardsCharactersKills
    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 easyjsonFa740090EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetFwLeaderboardsCharactersKillsList) {
    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 GetFwLeaderboardsCharactersKillsList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonFa740090EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetFwLeaderboardsCharactersKillsList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonFa740090EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetFwLeaderboardsCharactersKillsList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonFa740090DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetFwLeaderboardsCharactersKillsList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonFa740090DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonFa740090DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetFwLeaderboardsCharactersKills) {
    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 "active_total":
   107  			if in.IsNull() {
   108  				in.Skip()
   109  				out.ActiveTotal = nil
   110  			} else {
   111  				in.Delim('[')
   112  				if out.ActiveTotal == nil {
   113  					if !in.IsDelim(']') {
   114  						out.ActiveTotal = make([]GetFwLeaderboardsCharactersActiveTotalActiveTotal, 0, 8)
   115  					} else {
   116  						out.ActiveTotal = []GetFwLeaderboardsCharactersActiveTotalActiveTotal{}
   117  					}
   118  				} else {
   119  					out.ActiveTotal = (out.ActiveTotal)[:0]
   120  				}
   121  				for !in.IsDelim(']') {
   122  					var v4 GetFwLeaderboardsCharactersActiveTotalActiveTotal
   123  					easyjsonFa740090DecodeGithubComAntihaxGoesiEsi2(in, &v4)
   124  					out.ActiveTotal = append(out.ActiveTotal, v4)
   125  					in.WantComma()
   126  				}
   127  				in.Delim(']')
   128  			}
   129  		case "last_week":
   130  			if in.IsNull() {
   131  				in.Skip()
   132  				out.LastWeek = nil
   133  			} else {
   134  				in.Delim('[')
   135  				if out.LastWeek == nil {
   136  					if !in.IsDelim(']') {
   137  						out.LastWeek = make([]GetFwLeaderboardsCharactersLastWeekLastWeek, 0, 8)
   138  					} else {
   139  						out.LastWeek = []GetFwLeaderboardsCharactersLastWeekLastWeek{}
   140  					}
   141  				} else {
   142  					out.LastWeek = (out.LastWeek)[:0]
   143  				}
   144  				for !in.IsDelim(']') {
   145  					var v5 GetFwLeaderboardsCharactersLastWeekLastWeek
   146  					easyjsonFa740090DecodeGithubComAntihaxGoesiEsi3(in, &v5)
   147  					out.LastWeek = append(out.LastWeek, v5)
   148  					in.WantComma()
   149  				}
   150  				in.Delim(']')
   151  			}
   152  		case "yesterday":
   153  			if in.IsNull() {
   154  				in.Skip()
   155  				out.Yesterday = nil
   156  			} else {
   157  				in.Delim('[')
   158  				if out.Yesterday == nil {
   159  					if !in.IsDelim(']') {
   160  						out.Yesterday = make([]GetFwLeaderboardsCharactersYesterdayYesterday, 0, 8)
   161  					} else {
   162  						out.Yesterday = []GetFwLeaderboardsCharactersYesterdayYesterday{}
   163  					}
   164  				} else {
   165  					out.Yesterday = (out.Yesterday)[:0]
   166  				}
   167  				for !in.IsDelim(']') {
   168  					var v6 GetFwLeaderboardsCharactersYesterdayYesterday
   169  					easyjsonFa740090DecodeGithubComAntihaxGoesiEsi4(in, &v6)
   170  					out.Yesterday = append(out.Yesterday, v6)
   171  					in.WantComma()
   172  				}
   173  				in.Delim(']')
   174  			}
   175  		default:
   176  			in.SkipRecursive()
   177  		}
   178  		in.WantComma()
   179  	}
   180  	in.Delim('}')
   181  	if isTopLevel {
   182  		in.Consumed()
   183  	}
   184  }
   185  func easyjsonFa740090EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetFwLeaderboardsCharactersKills) {
   186  	out.RawByte('{')
   187  	first := true
   188  	_ = first
   189  	if len(in.ActiveTotal) != 0 {
   190  		const prefix string = ",\"active_total\":"
   191  		first = false
   192  		out.RawString(prefix[1:])
   193  		{
   194  			out.RawByte('[')
   195  			for v7, v8 := range in.ActiveTotal {
   196  				if v7 > 0 {
   197  					out.RawByte(',')
   198  				}
   199  				easyjsonFa740090EncodeGithubComAntihaxGoesiEsi2(out, v8)
   200  			}
   201  			out.RawByte(']')
   202  		}
   203  	}
   204  	if len(in.LastWeek) != 0 {
   205  		const prefix string = ",\"last_week\":"
   206  		if first {
   207  			first = false
   208  			out.RawString(prefix[1:])
   209  		} else {
   210  			out.RawString(prefix)
   211  		}
   212  		{
   213  			out.RawByte('[')
   214  			for v9, v10 := range in.LastWeek {
   215  				if v9 > 0 {
   216  					out.RawByte(',')
   217  				}
   218  				easyjsonFa740090EncodeGithubComAntihaxGoesiEsi3(out, v10)
   219  			}
   220  			out.RawByte(']')
   221  		}
   222  	}
   223  	if len(in.Yesterday) != 0 {
   224  		const prefix string = ",\"yesterday\":"
   225  		if first {
   226  			first = false
   227  			out.RawString(prefix[1:])
   228  		} else {
   229  			out.RawString(prefix)
   230  		}
   231  		{
   232  			out.RawByte('[')
   233  			for v11, v12 := range in.Yesterday {
   234  				if v11 > 0 {
   235  					out.RawByte(',')
   236  				}
   237  				easyjsonFa740090EncodeGithubComAntihaxGoesiEsi4(out, v12)
   238  			}
   239  			out.RawByte(']')
   240  		}
   241  	}
   242  	out.RawByte('}')
   243  }
   244  
   245  // MarshalJSON supports json.Marshaler interface
   246  func (v GetFwLeaderboardsCharactersKills) MarshalJSON() ([]byte, error) {
   247  	w := jwriter.Writer{}
   248  	easyjsonFa740090EncodeGithubComAntihaxGoesiEsi1(&w, v)
   249  	return w.Buffer.BuildBytes(), w.Error
   250  }
   251  
   252  // MarshalEasyJSON supports easyjson.Marshaler interface
   253  func (v GetFwLeaderboardsCharactersKills) MarshalEasyJSON(w *jwriter.Writer) {
   254  	easyjsonFa740090EncodeGithubComAntihaxGoesiEsi1(w, v)
   255  }
   256  
   257  // UnmarshalJSON supports json.Unmarshaler interface
   258  func (v *GetFwLeaderboardsCharactersKills) UnmarshalJSON(data []byte) error {
   259  	r := jlexer.Lexer{Data: data}
   260  	easyjsonFa740090DecodeGithubComAntihaxGoesiEsi1(&r, v)
   261  	return r.Error()
   262  }
   263  
   264  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   265  func (v *GetFwLeaderboardsCharactersKills) UnmarshalEasyJSON(l *jlexer.Lexer) {
   266  	easyjsonFa740090DecodeGithubComAntihaxGoesiEsi1(l, v)
   267  }
   268  func easyjsonFa740090DecodeGithubComAntihaxGoesiEsi4(in *jlexer.Lexer, out *GetFwLeaderboardsCharactersYesterdayYesterday) {
   269  	isTopLevel := in.IsStart()
   270  	if in.IsNull() {
   271  		if isTopLevel {
   272  			in.Consumed()
   273  		}
   274  		in.Skip()
   275  		return
   276  	}
   277  	in.Delim('{')
   278  	for !in.IsDelim('}') {
   279  		key := in.UnsafeFieldName(false)
   280  		in.WantColon()
   281  		if in.IsNull() {
   282  			in.Skip()
   283  			in.WantComma()
   284  			continue
   285  		}
   286  		switch key {
   287  		case "amount":
   288  			out.Amount = int32(in.Int32())
   289  		case "character_id":
   290  			out.CharacterId = int32(in.Int32())
   291  		default:
   292  			in.SkipRecursive()
   293  		}
   294  		in.WantComma()
   295  	}
   296  	in.Delim('}')
   297  	if isTopLevel {
   298  		in.Consumed()
   299  	}
   300  }
   301  func easyjsonFa740090EncodeGithubComAntihaxGoesiEsi4(out *jwriter.Writer, in GetFwLeaderboardsCharactersYesterdayYesterday) {
   302  	out.RawByte('{')
   303  	first := true
   304  	_ = first
   305  	if in.Amount != 0 {
   306  		const prefix string = ",\"amount\":"
   307  		first = false
   308  		out.RawString(prefix[1:])
   309  		out.Int32(int32(in.Amount))
   310  	}
   311  	if in.CharacterId != 0 {
   312  		const prefix string = ",\"character_id\":"
   313  		if first {
   314  			first = false
   315  			out.RawString(prefix[1:])
   316  		} else {
   317  			out.RawString(prefix)
   318  		}
   319  		out.Int32(int32(in.CharacterId))
   320  	}
   321  	out.RawByte('}')
   322  }
   323  func easyjsonFa740090DecodeGithubComAntihaxGoesiEsi3(in *jlexer.Lexer, out *GetFwLeaderboardsCharactersLastWeekLastWeek) {
   324  	isTopLevel := in.IsStart()
   325  	if in.IsNull() {
   326  		if isTopLevel {
   327  			in.Consumed()
   328  		}
   329  		in.Skip()
   330  		return
   331  	}
   332  	in.Delim('{')
   333  	for !in.IsDelim('}') {
   334  		key := in.UnsafeFieldName(false)
   335  		in.WantColon()
   336  		if in.IsNull() {
   337  			in.Skip()
   338  			in.WantComma()
   339  			continue
   340  		}
   341  		switch key {
   342  		case "amount":
   343  			out.Amount = int32(in.Int32())
   344  		case "character_id":
   345  			out.CharacterId = int32(in.Int32())
   346  		default:
   347  			in.SkipRecursive()
   348  		}
   349  		in.WantComma()
   350  	}
   351  	in.Delim('}')
   352  	if isTopLevel {
   353  		in.Consumed()
   354  	}
   355  }
   356  func easyjsonFa740090EncodeGithubComAntihaxGoesiEsi3(out *jwriter.Writer, in GetFwLeaderboardsCharactersLastWeekLastWeek) {
   357  	out.RawByte('{')
   358  	first := true
   359  	_ = first
   360  	if in.Amount != 0 {
   361  		const prefix string = ",\"amount\":"
   362  		first = false
   363  		out.RawString(prefix[1:])
   364  		out.Int32(int32(in.Amount))
   365  	}
   366  	if in.CharacterId != 0 {
   367  		const prefix string = ",\"character_id\":"
   368  		if first {
   369  			first = false
   370  			out.RawString(prefix[1:])
   371  		} else {
   372  			out.RawString(prefix)
   373  		}
   374  		out.Int32(int32(in.CharacterId))
   375  	}
   376  	out.RawByte('}')
   377  }
   378  func easyjsonFa740090DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetFwLeaderboardsCharactersActiveTotalActiveTotal) {
   379  	isTopLevel := in.IsStart()
   380  	if in.IsNull() {
   381  		if isTopLevel {
   382  			in.Consumed()
   383  		}
   384  		in.Skip()
   385  		return
   386  	}
   387  	in.Delim('{')
   388  	for !in.IsDelim('}') {
   389  		key := in.UnsafeFieldName(false)
   390  		in.WantColon()
   391  		if in.IsNull() {
   392  			in.Skip()
   393  			in.WantComma()
   394  			continue
   395  		}
   396  		switch key {
   397  		case "amount":
   398  			out.Amount = int32(in.Int32())
   399  		case "character_id":
   400  			out.CharacterId = int32(in.Int32())
   401  		default:
   402  			in.SkipRecursive()
   403  		}
   404  		in.WantComma()
   405  	}
   406  	in.Delim('}')
   407  	if isTopLevel {
   408  		in.Consumed()
   409  	}
   410  }
   411  func easyjsonFa740090EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetFwLeaderboardsCharactersActiveTotalActiveTotal) {
   412  	out.RawByte('{')
   413  	first := true
   414  	_ = first
   415  	if in.Amount != 0 {
   416  		const prefix string = ",\"amount\":"
   417  		first = false
   418  		out.RawString(prefix[1:])
   419  		out.Int32(int32(in.Amount))
   420  	}
   421  	if in.CharacterId != 0 {
   422  		const prefix string = ",\"character_id\":"
   423  		if first {
   424  			first = false
   425  			out.RawString(prefix[1:])
   426  		} else {
   427  			out.RawString(prefix)
   428  		}
   429  		out.Int32(int32(in.CharacterId))
   430  	}
   431  	out.RawByte('}')
   432  }