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