github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_killmails_killmail_id_killmail_hash_victim_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 easyjson8cf1533DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashVictimList) {
    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(GetKillmailsKillmailIdKillmailHashVictimList, 0, 0)
    31  			} else {
    32  				*out = GetKillmailsKillmailIdKillmailHashVictimList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetKillmailsKillmailIdKillmailHashVictim
    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 easyjson8cf1533EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashVictimList) {
    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 GetKillmailsKillmailIdKillmailHashVictimList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson8cf1533EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetKillmailsKillmailIdKillmailHashVictimList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson8cf1533EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetKillmailsKillmailIdKillmailHashVictimList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson8cf1533DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetKillmailsKillmailIdKillmailHashVictimList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson8cf1533DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson8cf1533DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashVictim) {
    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 "alliance_id":
   107  			out.AllianceId = int32(in.Int32())
   108  		case "character_id":
   109  			out.CharacterId = int32(in.Int32())
   110  		case "corporation_id":
   111  			out.CorporationId = int32(in.Int32())
   112  		case "damage_taken":
   113  			out.DamageTaken = int32(in.Int32())
   114  		case "faction_id":
   115  			out.FactionId = int32(in.Int32())
   116  		case "items":
   117  			if in.IsNull() {
   118  				in.Skip()
   119  				out.Items = nil
   120  			} else {
   121  				in.Delim('[')
   122  				if out.Items == nil {
   123  					if !in.IsDelim(']') {
   124  						out.Items = make([]GetKillmailsKillmailIdKillmailHashItem, 0, 1)
   125  					} else {
   126  						out.Items = []GetKillmailsKillmailIdKillmailHashItem{}
   127  					}
   128  				} else {
   129  					out.Items = (out.Items)[:0]
   130  				}
   131  				for !in.IsDelim(']') {
   132  					var v4 GetKillmailsKillmailIdKillmailHashItem
   133  					easyjson8cf1533DecodeGithubComAntihaxGoesiEsi2(in, &v4)
   134  					out.Items = append(out.Items, v4)
   135  					in.WantComma()
   136  				}
   137  				in.Delim(']')
   138  			}
   139  		case "position":
   140  			easyjson8cf1533DecodeGithubComAntihaxGoesiEsi3(in, &out.Position)
   141  		case "ship_type_id":
   142  			out.ShipTypeId = int32(in.Int32())
   143  		default:
   144  			in.SkipRecursive()
   145  		}
   146  		in.WantComma()
   147  	}
   148  	in.Delim('}')
   149  	if isTopLevel {
   150  		in.Consumed()
   151  	}
   152  }
   153  func easyjson8cf1533EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashVictim) {
   154  	out.RawByte('{')
   155  	first := true
   156  	_ = first
   157  	if in.AllianceId != 0 {
   158  		const prefix string = ",\"alliance_id\":"
   159  		first = false
   160  		out.RawString(prefix[1:])
   161  		out.Int32(int32(in.AllianceId))
   162  	}
   163  	if in.CharacterId != 0 {
   164  		const prefix string = ",\"character_id\":"
   165  		if first {
   166  			first = false
   167  			out.RawString(prefix[1:])
   168  		} else {
   169  			out.RawString(prefix)
   170  		}
   171  		out.Int32(int32(in.CharacterId))
   172  	}
   173  	if in.CorporationId != 0 {
   174  		const prefix string = ",\"corporation_id\":"
   175  		if first {
   176  			first = false
   177  			out.RawString(prefix[1:])
   178  		} else {
   179  			out.RawString(prefix)
   180  		}
   181  		out.Int32(int32(in.CorporationId))
   182  	}
   183  	if in.DamageTaken != 0 {
   184  		const prefix string = ",\"damage_taken\":"
   185  		if first {
   186  			first = false
   187  			out.RawString(prefix[1:])
   188  		} else {
   189  			out.RawString(prefix)
   190  		}
   191  		out.Int32(int32(in.DamageTaken))
   192  	}
   193  	if in.FactionId != 0 {
   194  		const prefix string = ",\"faction_id\":"
   195  		if first {
   196  			first = false
   197  			out.RawString(prefix[1:])
   198  		} else {
   199  			out.RawString(prefix)
   200  		}
   201  		out.Int32(int32(in.FactionId))
   202  	}
   203  	if len(in.Items) != 0 {
   204  		const prefix string = ",\"items\":"
   205  		if first {
   206  			first = false
   207  			out.RawString(prefix[1:])
   208  		} else {
   209  			out.RawString(prefix)
   210  		}
   211  		{
   212  			out.RawByte('[')
   213  			for v5, v6 := range in.Items {
   214  				if v5 > 0 {
   215  					out.RawByte(',')
   216  				}
   217  				easyjson8cf1533EncodeGithubComAntihaxGoesiEsi2(out, v6)
   218  			}
   219  			out.RawByte(']')
   220  		}
   221  	}
   222  	if true {
   223  		const prefix string = ",\"position\":"
   224  		if first {
   225  			first = false
   226  			out.RawString(prefix[1:])
   227  		} else {
   228  			out.RawString(prefix)
   229  		}
   230  		easyjson8cf1533EncodeGithubComAntihaxGoesiEsi3(out, in.Position)
   231  	}
   232  	if in.ShipTypeId != 0 {
   233  		const prefix string = ",\"ship_type_id\":"
   234  		if first {
   235  			first = false
   236  			out.RawString(prefix[1:])
   237  		} else {
   238  			out.RawString(prefix)
   239  		}
   240  		out.Int32(int32(in.ShipTypeId))
   241  	}
   242  	out.RawByte('}')
   243  }
   244  
   245  // MarshalJSON supports json.Marshaler interface
   246  func (v GetKillmailsKillmailIdKillmailHashVictim) MarshalJSON() ([]byte, error) {
   247  	w := jwriter.Writer{}
   248  	easyjson8cf1533EncodeGithubComAntihaxGoesiEsi1(&w, v)
   249  	return w.Buffer.BuildBytes(), w.Error
   250  }
   251  
   252  // MarshalEasyJSON supports easyjson.Marshaler interface
   253  func (v GetKillmailsKillmailIdKillmailHashVictim) MarshalEasyJSON(w *jwriter.Writer) {
   254  	easyjson8cf1533EncodeGithubComAntihaxGoesiEsi1(w, v)
   255  }
   256  
   257  // UnmarshalJSON supports json.Unmarshaler interface
   258  func (v *GetKillmailsKillmailIdKillmailHashVictim) UnmarshalJSON(data []byte) error {
   259  	r := jlexer.Lexer{Data: data}
   260  	easyjson8cf1533DecodeGithubComAntihaxGoesiEsi1(&r, v)
   261  	return r.Error()
   262  }
   263  
   264  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   265  func (v *GetKillmailsKillmailIdKillmailHashVictim) UnmarshalEasyJSON(l *jlexer.Lexer) {
   266  	easyjson8cf1533DecodeGithubComAntihaxGoesiEsi1(l, v)
   267  }
   268  func easyjson8cf1533DecodeGithubComAntihaxGoesiEsi3(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashPosition) {
   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 "x":
   288  			out.X = float64(in.Float64())
   289  		case "y":
   290  			out.Y = float64(in.Float64())
   291  		case "z":
   292  			out.Z = float64(in.Float64())
   293  		default:
   294  			in.SkipRecursive()
   295  		}
   296  		in.WantComma()
   297  	}
   298  	in.Delim('}')
   299  	if isTopLevel {
   300  		in.Consumed()
   301  	}
   302  }
   303  func easyjson8cf1533EncodeGithubComAntihaxGoesiEsi3(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashPosition) {
   304  	out.RawByte('{')
   305  	first := true
   306  	_ = first
   307  	if in.X != 0 {
   308  		const prefix string = ",\"x\":"
   309  		first = false
   310  		out.RawString(prefix[1:])
   311  		out.Float64(float64(in.X))
   312  	}
   313  	if in.Y != 0 {
   314  		const prefix string = ",\"y\":"
   315  		if first {
   316  			first = false
   317  			out.RawString(prefix[1:])
   318  		} else {
   319  			out.RawString(prefix)
   320  		}
   321  		out.Float64(float64(in.Y))
   322  	}
   323  	if in.Z != 0 {
   324  		const prefix string = ",\"z\":"
   325  		if first {
   326  			first = false
   327  			out.RawString(prefix[1:])
   328  		} else {
   329  			out.RawString(prefix)
   330  		}
   331  		out.Float64(float64(in.Z))
   332  	}
   333  	out.RawByte('}')
   334  }
   335  func easyjson8cf1533DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashItem) {
   336  	isTopLevel := in.IsStart()
   337  	if in.IsNull() {
   338  		if isTopLevel {
   339  			in.Consumed()
   340  		}
   341  		in.Skip()
   342  		return
   343  	}
   344  	in.Delim('{')
   345  	for !in.IsDelim('}') {
   346  		key := in.UnsafeFieldName(false)
   347  		in.WantColon()
   348  		if in.IsNull() {
   349  			in.Skip()
   350  			in.WantComma()
   351  			continue
   352  		}
   353  		switch key {
   354  		case "flag":
   355  			out.Flag = int32(in.Int32())
   356  		case "item_type_id":
   357  			out.ItemTypeId = int32(in.Int32())
   358  		case "items":
   359  			if in.IsNull() {
   360  				in.Skip()
   361  				out.Items = nil
   362  			} else {
   363  				in.Delim('[')
   364  				if out.Items == nil {
   365  					if !in.IsDelim(']') {
   366  						out.Items = make([]GetKillmailsKillmailIdKillmailHashItemsItem, 0, 2)
   367  					} else {
   368  						out.Items = []GetKillmailsKillmailIdKillmailHashItemsItem{}
   369  					}
   370  				} else {
   371  					out.Items = (out.Items)[:0]
   372  				}
   373  				for !in.IsDelim(']') {
   374  					var v7 GetKillmailsKillmailIdKillmailHashItemsItem
   375  					easyjson8cf1533DecodeGithubComAntihaxGoesiEsi4(in, &v7)
   376  					out.Items = append(out.Items, v7)
   377  					in.WantComma()
   378  				}
   379  				in.Delim(']')
   380  			}
   381  		case "quantity_destroyed":
   382  			out.QuantityDestroyed = int64(in.Int64())
   383  		case "quantity_dropped":
   384  			out.QuantityDropped = int64(in.Int64())
   385  		case "singleton":
   386  			out.Singleton = int32(in.Int32())
   387  		default:
   388  			in.SkipRecursive()
   389  		}
   390  		in.WantComma()
   391  	}
   392  	in.Delim('}')
   393  	if isTopLevel {
   394  		in.Consumed()
   395  	}
   396  }
   397  func easyjson8cf1533EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashItem) {
   398  	out.RawByte('{')
   399  	first := true
   400  	_ = first
   401  	if in.Flag != 0 {
   402  		const prefix string = ",\"flag\":"
   403  		first = false
   404  		out.RawString(prefix[1:])
   405  		out.Int32(int32(in.Flag))
   406  	}
   407  	if in.ItemTypeId != 0 {
   408  		const prefix string = ",\"item_type_id\":"
   409  		if first {
   410  			first = false
   411  			out.RawString(prefix[1:])
   412  		} else {
   413  			out.RawString(prefix)
   414  		}
   415  		out.Int32(int32(in.ItemTypeId))
   416  	}
   417  	if len(in.Items) != 0 {
   418  		const prefix string = ",\"items\":"
   419  		if first {
   420  			first = false
   421  			out.RawString(prefix[1:])
   422  		} else {
   423  			out.RawString(prefix)
   424  		}
   425  		{
   426  			out.RawByte('[')
   427  			for v8, v9 := range in.Items {
   428  				if v8 > 0 {
   429  					out.RawByte(',')
   430  				}
   431  				easyjson8cf1533EncodeGithubComAntihaxGoesiEsi4(out, v9)
   432  			}
   433  			out.RawByte(']')
   434  		}
   435  	}
   436  	if in.QuantityDestroyed != 0 {
   437  		const prefix string = ",\"quantity_destroyed\":"
   438  		if first {
   439  			first = false
   440  			out.RawString(prefix[1:])
   441  		} else {
   442  			out.RawString(prefix)
   443  		}
   444  		out.Int64(int64(in.QuantityDestroyed))
   445  	}
   446  	if in.QuantityDropped != 0 {
   447  		const prefix string = ",\"quantity_dropped\":"
   448  		if first {
   449  			first = false
   450  			out.RawString(prefix[1:])
   451  		} else {
   452  			out.RawString(prefix)
   453  		}
   454  		out.Int64(int64(in.QuantityDropped))
   455  	}
   456  	if in.Singleton != 0 {
   457  		const prefix string = ",\"singleton\":"
   458  		if first {
   459  			first = false
   460  			out.RawString(prefix[1:])
   461  		} else {
   462  			out.RawString(prefix)
   463  		}
   464  		out.Int32(int32(in.Singleton))
   465  	}
   466  	out.RawByte('}')
   467  }
   468  func easyjson8cf1533DecodeGithubComAntihaxGoesiEsi4(in *jlexer.Lexer, out *GetKillmailsKillmailIdKillmailHashItemsItem) {
   469  	isTopLevel := in.IsStart()
   470  	if in.IsNull() {
   471  		if isTopLevel {
   472  			in.Consumed()
   473  		}
   474  		in.Skip()
   475  		return
   476  	}
   477  	in.Delim('{')
   478  	for !in.IsDelim('}') {
   479  		key := in.UnsafeFieldName(false)
   480  		in.WantColon()
   481  		if in.IsNull() {
   482  			in.Skip()
   483  			in.WantComma()
   484  			continue
   485  		}
   486  		switch key {
   487  		case "flag":
   488  			out.Flag = int32(in.Int32())
   489  		case "item_type_id":
   490  			out.ItemTypeId = int32(in.Int32())
   491  		case "quantity_destroyed":
   492  			out.QuantityDestroyed = int64(in.Int64())
   493  		case "quantity_dropped":
   494  			out.QuantityDropped = int64(in.Int64())
   495  		case "singleton":
   496  			out.Singleton = int32(in.Int32())
   497  		default:
   498  			in.SkipRecursive()
   499  		}
   500  		in.WantComma()
   501  	}
   502  	in.Delim('}')
   503  	if isTopLevel {
   504  		in.Consumed()
   505  	}
   506  }
   507  func easyjson8cf1533EncodeGithubComAntihaxGoesiEsi4(out *jwriter.Writer, in GetKillmailsKillmailIdKillmailHashItemsItem) {
   508  	out.RawByte('{')
   509  	first := true
   510  	_ = first
   511  	if in.Flag != 0 {
   512  		const prefix string = ",\"flag\":"
   513  		first = false
   514  		out.RawString(prefix[1:])
   515  		out.Int32(int32(in.Flag))
   516  	}
   517  	if in.ItemTypeId != 0 {
   518  		const prefix string = ",\"item_type_id\":"
   519  		if first {
   520  			first = false
   521  			out.RawString(prefix[1:])
   522  		} else {
   523  			out.RawString(prefix)
   524  		}
   525  		out.Int32(int32(in.ItemTypeId))
   526  	}
   527  	if in.QuantityDestroyed != 0 {
   528  		const prefix string = ",\"quantity_destroyed\":"
   529  		if first {
   530  			first = false
   531  			out.RawString(prefix[1:])
   532  		} else {
   533  			out.RawString(prefix)
   534  		}
   535  		out.Int64(int64(in.QuantityDestroyed))
   536  	}
   537  	if in.QuantityDropped != 0 {
   538  		const prefix string = ",\"quantity_dropped\":"
   539  		if first {
   540  			first = false
   541  			out.RawString(prefix[1:])
   542  		} else {
   543  			out.RawString(prefix)
   544  		}
   545  		out.Int64(int64(in.QuantityDropped))
   546  	}
   547  	if in.Singleton != 0 {
   548  		const prefix string = ",\"singleton\":"
   549  		if first {
   550  			first = false
   551  			out.RawString(prefix[1:])
   552  		} else {
   553  			out.RawString(prefix)
   554  		}
   555  		out.Int32(int32(in.Singleton))
   556  	}
   557  	out.RawByte('}')
   558  }