github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_universe_stargates_stargate_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 easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetUniverseStargatesStargateIdOkList) {
    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(GetUniverseStargatesStargateIdOkList, 0, 1)
    31  			} else {
    32  				*out = GetUniverseStargatesStargateIdOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetUniverseStargatesStargateIdOk
    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 easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetUniverseStargatesStargateIdOkList) {
    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 GetUniverseStargatesStargateIdOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetUniverseStargatesStargateIdOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetUniverseStargatesStargateIdOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetUniverseStargatesStargateIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetUniverseStargatesStargateIdOk) {
    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 "destination":
   107  			easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi2(in, &out.Destination)
   108  		case "name":
   109  			out.Name = string(in.String())
   110  		case "position":
   111  			easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi3(in, &out.Position)
   112  		case "stargate_id":
   113  			out.StargateId = int32(in.Int32())
   114  		case "system_id":
   115  			out.SystemId = int32(in.Int32())
   116  		case "type_id":
   117  			out.TypeId = int32(in.Int32())
   118  		default:
   119  			in.SkipRecursive()
   120  		}
   121  		in.WantComma()
   122  	}
   123  	in.Delim('}')
   124  	if isTopLevel {
   125  		in.Consumed()
   126  	}
   127  }
   128  func easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetUniverseStargatesStargateIdOk) {
   129  	out.RawByte('{')
   130  	first := true
   131  	_ = first
   132  	if true {
   133  		const prefix string = ",\"destination\":"
   134  		first = false
   135  		out.RawString(prefix[1:])
   136  		easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi2(out, in.Destination)
   137  	}
   138  	if in.Name != "" {
   139  		const prefix string = ",\"name\":"
   140  		if first {
   141  			first = false
   142  			out.RawString(prefix[1:])
   143  		} else {
   144  			out.RawString(prefix)
   145  		}
   146  		out.String(string(in.Name))
   147  	}
   148  	if true {
   149  		const prefix string = ",\"position\":"
   150  		if first {
   151  			first = false
   152  			out.RawString(prefix[1:])
   153  		} else {
   154  			out.RawString(prefix)
   155  		}
   156  		easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi3(out, in.Position)
   157  	}
   158  	if in.StargateId != 0 {
   159  		const prefix string = ",\"stargate_id\":"
   160  		if first {
   161  			first = false
   162  			out.RawString(prefix[1:])
   163  		} else {
   164  			out.RawString(prefix)
   165  		}
   166  		out.Int32(int32(in.StargateId))
   167  	}
   168  	if in.SystemId != 0 {
   169  		const prefix string = ",\"system_id\":"
   170  		if first {
   171  			first = false
   172  			out.RawString(prefix[1:])
   173  		} else {
   174  			out.RawString(prefix)
   175  		}
   176  		out.Int32(int32(in.SystemId))
   177  	}
   178  	if in.TypeId != 0 {
   179  		const prefix string = ",\"type_id\":"
   180  		if first {
   181  			first = false
   182  			out.RawString(prefix[1:])
   183  		} else {
   184  			out.RawString(prefix)
   185  		}
   186  		out.Int32(int32(in.TypeId))
   187  	}
   188  	out.RawByte('}')
   189  }
   190  
   191  // MarshalJSON supports json.Marshaler interface
   192  func (v GetUniverseStargatesStargateIdOk) MarshalJSON() ([]byte, error) {
   193  	w := jwriter.Writer{}
   194  	easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi1(&w, v)
   195  	return w.Buffer.BuildBytes(), w.Error
   196  }
   197  
   198  // MarshalEasyJSON supports easyjson.Marshaler interface
   199  func (v GetUniverseStargatesStargateIdOk) MarshalEasyJSON(w *jwriter.Writer) {
   200  	easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi1(w, v)
   201  }
   202  
   203  // UnmarshalJSON supports json.Unmarshaler interface
   204  func (v *GetUniverseStargatesStargateIdOk) UnmarshalJSON(data []byte) error {
   205  	r := jlexer.Lexer{Data: data}
   206  	easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi1(&r, v)
   207  	return r.Error()
   208  }
   209  
   210  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   211  func (v *GetUniverseStargatesStargateIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   212  	easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi1(l, v)
   213  }
   214  func easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi3(in *jlexer.Lexer, out *GetUniverseStargatesStargateIdPosition) {
   215  	isTopLevel := in.IsStart()
   216  	if in.IsNull() {
   217  		if isTopLevel {
   218  			in.Consumed()
   219  		}
   220  		in.Skip()
   221  		return
   222  	}
   223  	in.Delim('{')
   224  	for !in.IsDelim('}') {
   225  		key := in.UnsafeFieldName(false)
   226  		in.WantColon()
   227  		if in.IsNull() {
   228  			in.Skip()
   229  			in.WantComma()
   230  			continue
   231  		}
   232  		switch key {
   233  		case "x":
   234  			out.X = float64(in.Float64())
   235  		case "y":
   236  			out.Y = float64(in.Float64())
   237  		case "z":
   238  			out.Z = float64(in.Float64())
   239  		default:
   240  			in.SkipRecursive()
   241  		}
   242  		in.WantComma()
   243  	}
   244  	in.Delim('}')
   245  	if isTopLevel {
   246  		in.Consumed()
   247  	}
   248  }
   249  func easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi3(out *jwriter.Writer, in GetUniverseStargatesStargateIdPosition) {
   250  	out.RawByte('{')
   251  	first := true
   252  	_ = first
   253  	if in.X != 0 {
   254  		const prefix string = ",\"x\":"
   255  		first = false
   256  		out.RawString(prefix[1:])
   257  		out.Float64(float64(in.X))
   258  	}
   259  	if in.Y != 0 {
   260  		const prefix string = ",\"y\":"
   261  		if first {
   262  			first = false
   263  			out.RawString(prefix[1:])
   264  		} else {
   265  			out.RawString(prefix)
   266  		}
   267  		out.Float64(float64(in.Y))
   268  	}
   269  	if in.Z != 0 {
   270  		const prefix string = ",\"z\":"
   271  		if first {
   272  			first = false
   273  			out.RawString(prefix[1:])
   274  		} else {
   275  			out.RawString(prefix)
   276  		}
   277  		out.Float64(float64(in.Z))
   278  	}
   279  	out.RawByte('}')
   280  }
   281  func easyjson5e0a8a62DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetUniverseStargatesStargateIdDestination) {
   282  	isTopLevel := in.IsStart()
   283  	if in.IsNull() {
   284  		if isTopLevel {
   285  			in.Consumed()
   286  		}
   287  		in.Skip()
   288  		return
   289  	}
   290  	in.Delim('{')
   291  	for !in.IsDelim('}') {
   292  		key := in.UnsafeFieldName(false)
   293  		in.WantColon()
   294  		if in.IsNull() {
   295  			in.Skip()
   296  			in.WantComma()
   297  			continue
   298  		}
   299  		switch key {
   300  		case "stargate_id":
   301  			out.StargateId = int32(in.Int32())
   302  		case "system_id":
   303  			out.SystemId = int32(in.Int32())
   304  		default:
   305  			in.SkipRecursive()
   306  		}
   307  		in.WantComma()
   308  	}
   309  	in.Delim('}')
   310  	if isTopLevel {
   311  		in.Consumed()
   312  	}
   313  }
   314  func easyjson5e0a8a62EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetUniverseStargatesStargateIdDestination) {
   315  	out.RawByte('{')
   316  	first := true
   317  	_ = first
   318  	if in.StargateId != 0 {
   319  		const prefix string = ",\"stargate_id\":"
   320  		first = false
   321  		out.RawString(prefix[1:])
   322  		out.Int32(int32(in.StargateId))
   323  	}
   324  	if in.SystemId != 0 {
   325  		const prefix string = ",\"system_id\":"
   326  		if first {
   327  			first = false
   328  			out.RawString(prefix[1:])
   329  		} else {
   330  			out.RawString(prefix)
   331  		}
   332  		out.Int32(int32(in.SystemId))
   333  	}
   334  	out.RawByte('}')
   335  }