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