github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_incursions_200_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 easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetIncursions200OkList) {
    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(GetIncursions200OkList, 0, 0)
    31  			} else {
    32  				*out = GetIncursions200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetIncursions200Ok
    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 easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetIncursions200OkList) {
    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 GetIncursions200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetIncursions200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetIncursions200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetIncursions200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetIncursions200Ok) {
    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 "constellation_id":
   107  			out.ConstellationId = int32(in.Int32())
   108  		case "faction_id":
   109  			out.FactionId = int32(in.Int32())
   110  		case "has_boss":
   111  			out.HasBoss = bool(in.Bool())
   112  		case "infested_solar_systems":
   113  			if in.IsNull() {
   114  				in.Skip()
   115  				out.InfestedSolarSystems = nil
   116  			} else {
   117  				in.Delim('[')
   118  				if out.InfestedSolarSystems == nil {
   119  					if !in.IsDelim(']') {
   120  						out.InfestedSolarSystems = make([]int32, 0, 16)
   121  					} else {
   122  						out.InfestedSolarSystems = []int32{}
   123  					}
   124  				} else {
   125  					out.InfestedSolarSystems = (out.InfestedSolarSystems)[:0]
   126  				}
   127  				for !in.IsDelim(']') {
   128  					var v4 int32
   129  					v4 = int32(in.Int32())
   130  					out.InfestedSolarSystems = append(out.InfestedSolarSystems, v4)
   131  					in.WantComma()
   132  				}
   133  				in.Delim(']')
   134  			}
   135  		case "influence":
   136  			out.Influence = float32(in.Float32())
   137  		case "staging_solar_system_id":
   138  			out.StagingSolarSystemId = int32(in.Int32())
   139  		case "state":
   140  			out.State = string(in.String())
   141  		case "type":
   142  			out.Type_ = string(in.String())
   143  		default:
   144  			in.SkipRecursive()
   145  		}
   146  		in.WantComma()
   147  	}
   148  	in.Delim('}')
   149  	if isTopLevel {
   150  		in.Consumed()
   151  	}
   152  }
   153  func easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetIncursions200Ok) {
   154  	out.RawByte('{')
   155  	first := true
   156  	_ = first
   157  	if in.ConstellationId != 0 {
   158  		const prefix string = ",\"constellation_id\":"
   159  		first = false
   160  		out.RawString(prefix[1:])
   161  		out.Int32(int32(in.ConstellationId))
   162  	}
   163  	if in.FactionId != 0 {
   164  		const prefix string = ",\"faction_id\":"
   165  		if first {
   166  			first = false
   167  			out.RawString(prefix[1:])
   168  		} else {
   169  			out.RawString(prefix)
   170  		}
   171  		out.Int32(int32(in.FactionId))
   172  	}
   173  	if in.HasBoss {
   174  		const prefix string = ",\"has_boss\":"
   175  		if first {
   176  			first = false
   177  			out.RawString(prefix[1:])
   178  		} else {
   179  			out.RawString(prefix)
   180  		}
   181  		out.Bool(bool(in.HasBoss))
   182  	}
   183  	if len(in.InfestedSolarSystems) != 0 {
   184  		const prefix string = ",\"infested_solar_systems\":"
   185  		if first {
   186  			first = false
   187  			out.RawString(prefix[1:])
   188  		} else {
   189  			out.RawString(prefix)
   190  		}
   191  		{
   192  			out.RawByte('[')
   193  			for v5, v6 := range in.InfestedSolarSystems {
   194  				if v5 > 0 {
   195  					out.RawByte(',')
   196  				}
   197  				out.Int32(int32(v6))
   198  			}
   199  			out.RawByte(']')
   200  		}
   201  	}
   202  	if in.Influence != 0 {
   203  		const prefix string = ",\"influence\":"
   204  		if first {
   205  			first = false
   206  			out.RawString(prefix[1:])
   207  		} else {
   208  			out.RawString(prefix)
   209  		}
   210  		out.Float32(float32(in.Influence))
   211  	}
   212  	if in.StagingSolarSystemId != 0 {
   213  		const prefix string = ",\"staging_solar_system_id\":"
   214  		if first {
   215  			first = false
   216  			out.RawString(prefix[1:])
   217  		} else {
   218  			out.RawString(prefix)
   219  		}
   220  		out.Int32(int32(in.StagingSolarSystemId))
   221  	}
   222  	if in.State != "" {
   223  		const prefix string = ",\"state\":"
   224  		if first {
   225  			first = false
   226  			out.RawString(prefix[1:])
   227  		} else {
   228  			out.RawString(prefix)
   229  		}
   230  		out.String(string(in.State))
   231  	}
   232  	if in.Type_ != "" {
   233  		const prefix string = ",\"type\":"
   234  		if first {
   235  			first = false
   236  			out.RawString(prefix[1:])
   237  		} else {
   238  			out.RawString(prefix)
   239  		}
   240  		out.String(string(in.Type_))
   241  	}
   242  	out.RawByte('}')
   243  }
   244  
   245  // MarshalJSON supports json.Marshaler interface
   246  func (v GetIncursions200Ok) MarshalJSON() ([]byte, error) {
   247  	w := jwriter.Writer{}
   248  	easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi1(&w, v)
   249  	return w.Buffer.BuildBytes(), w.Error
   250  }
   251  
   252  // MarshalEasyJSON supports easyjson.Marshaler interface
   253  func (v GetIncursions200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   254  	easyjsonAb919c82EncodeGithubComAntihaxGoesiEsi1(w, v)
   255  }
   256  
   257  // UnmarshalJSON supports json.Unmarshaler interface
   258  func (v *GetIncursions200Ok) UnmarshalJSON(data []byte) error {
   259  	r := jlexer.Lexer{Data: data}
   260  	easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi1(&r, v)
   261  	return r.Error()
   262  }
   263  
   264  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   265  func (v *GetIncursions200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   266  	easyjsonAb919c82DecodeGithubComAntihaxGoesiEsi1(l, v)
   267  }