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