github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_orders_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 easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdOrders200OkList) {
    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(GetCharactersCharacterIdOrders200OkList, 0, 0)
    31  			} else {
    32  				*out = GetCharactersCharacterIdOrders200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdOrders200Ok
    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 easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdOrders200OkList) {
    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 GetCharactersCharacterIdOrders200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdOrders200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdOrders200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdOrders200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdOrders200Ok) {
    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 "duration":
   107  			out.Duration = int32(in.Int32())
   108  		case "escrow":
   109  			out.Escrow = float64(in.Float64())
   110  		case "is_buy_order":
   111  			out.IsBuyOrder = bool(in.Bool())
   112  		case "is_corporation":
   113  			out.IsCorporation = bool(in.Bool())
   114  		case "issued":
   115  			if data := in.Raw(); in.Ok() {
   116  				in.AddError((out.Issued).UnmarshalJSON(data))
   117  			}
   118  		case "location_id":
   119  			out.LocationId = int64(in.Int64())
   120  		case "min_volume":
   121  			out.MinVolume = int32(in.Int32())
   122  		case "order_id":
   123  			out.OrderId = int64(in.Int64())
   124  		case "price":
   125  			out.Price = float64(in.Float64())
   126  		case "range":
   127  			out.Range_ = string(in.String())
   128  		case "region_id":
   129  			out.RegionId = int32(in.Int32())
   130  		case "type_id":
   131  			out.TypeId = int32(in.Int32())
   132  		case "volume_remain":
   133  			out.VolumeRemain = int32(in.Int32())
   134  		case "volume_total":
   135  			out.VolumeTotal = int32(in.Int32())
   136  		default:
   137  			in.SkipRecursive()
   138  		}
   139  		in.WantComma()
   140  	}
   141  	in.Delim('}')
   142  	if isTopLevel {
   143  		in.Consumed()
   144  	}
   145  }
   146  func easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdOrders200Ok) {
   147  	out.RawByte('{')
   148  	first := true
   149  	_ = first
   150  	if in.Duration != 0 {
   151  		const prefix string = ",\"duration\":"
   152  		first = false
   153  		out.RawString(prefix[1:])
   154  		out.Int32(int32(in.Duration))
   155  	}
   156  	if in.Escrow != 0 {
   157  		const prefix string = ",\"escrow\":"
   158  		if first {
   159  			first = false
   160  			out.RawString(prefix[1:])
   161  		} else {
   162  			out.RawString(prefix)
   163  		}
   164  		out.Float64(float64(in.Escrow))
   165  	}
   166  	if in.IsBuyOrder {
   167  		const prefix string = ",\"is_buy_order\":"
   168  		if first {
   169  			first = false
   170  			out.RawString(prefix[1:])
   171  		} else {
   172  			out.RawString(prefix)
   173  		}
   174  		out.Bool(bool(in.IsBuyOrder))
   175  	}
   176  	if in.IsCorporation {
   177  		const prefix string = ",\"is_corporation\":"
   178  		if first {
   179  			first = false
   180  			out.RawString(prefix[1:])
   181  		} else {
   182  			out.RawString(prefix)
   183  		}
   184  		out.Bool(bool(in.IsCorporation))
   185  	}
   186  	if true {
   187  		const prefix string = ",\"issued\":"
   188  		if first {
   189  			first = false
   190  			out.RawString(prefix[1:])
   191  		} else {
   192  			out.RawString(prefix)
   193  		}
   194  		out.Raw((in.Issued).MarshalJSON())
   195  	}
   196  	if in.LocationId != 0 {
   197  		const prefix string = ",\"location_id\":"
   198  		if first {
   199  			first = false
   200  			out.RawString(prefix[1:])
   201  		} else {
   202  			out.RawString(prefix)
   203  		}
   204  		out.Int64(int64(in.LocationId))
   205  	}
   206  	if in.MinVolume != 0 {
   207  		const prefix string = ",\"min_volume\":"
   208  		if first {
   209  			first = false
   210  			out.RawString(prefix[1:])
   211  		} else {
   212  			out.RawString(prefix)
   213  		}
   214  		out.Int32(int32(in.MinVolume))
   215  	}
   216  	if in.OrderId != 0 {
   217  		const prefix string = ",\"order_id\":"
   218  		if first {
   219  			first = false
   220  			out.RawString(prefix[1:])
   221  		} else {
   222  			out.RawString(prefix)
   223  		}
   224  		out.Int64(int64(in.OrderId))
   225  	}
   226  	if in.Price != 0 {
   227  		const prefix string = ",\"price\":"
   228  		if first {
   229  			first = false
   230  			out.RawString(prefix[1:])
   231  		} else {
   232  			out.RawString(prefix)
   233  		}
   234  		out.Float64(float64(in.Price))
   235  	}
   236  	if in.Range_ != "" {
   237  		const prefix string = ",\"range\":"
   238  		if first {
   239  			first = false
   240  			out.RawString(prefix[1:])
   241  		} else {
   242  			out.RawString(prefix)
   243  		}
   244  		out.String(string(in.Range_))
   245  	}
   246  	if in.RegionId != 0 {
   247  		const prefix string = ",\"region_id\":"
   248  		if first {
   249  			first = false
   250  			out.RawString(prefix[1:])
   251  		} else {
   252  			out.RawString(prefix)
   253  		}
   254  		out.Int32(int32(in.RegionId))
   255  	}
   256  	if in.TypeId != 0 {
   257  		const prefix string = ",\"type_id\":"
   258  		if first {
   259  			first = false
   260  			out.RawString(prefix[1:])
   261  		} else {
   262  			out.RawString(prefix)
   263  		}
   264  		out.Int32(int32(in.TypeId))
   265  	}
   266  	if in.VolumeRemain != 0 {
   267  		const prefix string = ",\"volume_remain\":"
   268  		if first {
   269  			first = false
   270  			out.RawString(prefix[1:])
   271  		} else {
   272  			out.RawString(prefix)
   273  		}
   274  		out.Int32(int32(in.VolumeRemain))
   275  	}
   276  	if in.VolumeTotal != 0 {
   277  		const prefix string = ",\"volume_total\":"
   278  		if first {
   279  			first = false
   280  			out.RawString(prefix[1:])
   281  		} else {
   282  			out.RawString(prefix)
   283  		}
   284  		out.Int32(int32(in.VolumeTotal))
   285  	}
   286  	out.RawByte('}')
   287  }
   288  
   289  // MarshalJSON supports json.Marshaler interface
   290  func (v GetCharactersCharacterIdOrders200Ok) MarshalJSON() ([]byte, error) {
   291  	w := jwriter.Writer{}
   292  	easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi1(&w, v)
   293  	return w.Buffer.BuildBytes(), w.Error
   294  }
   295  
   296  // MarshalEasyJSON supports easyjson.Marshaler interface
   297  func (v GetCharactersCharacterIdOrders200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   298  	easyjsonEec0496dEncodeGithubComAntihaxGoesiEsi1(w, v)
   299  }
   300  
   301  // UnmarshalJSON supports json.Unmarshaler interface
   302  func (v *GetCharactersCharacterIdOrders200Ok) UnmarshalJSON(data []byte) error {
   303  	r := jlexer.Lexer{Data: data}
   304  	easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi1(&r, v)
   305  	return r.Error()
   306  }
   307  
   308  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   309  func (v *GetCharactersCharacterIdOrders200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   310  	easyjsonEec0496dDecodeGithubComAntihaxGoesiEsi1(l, v)
   311  }