github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_wallet_transactions_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 easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdWalletTransactions200OkList) {
    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(GetCharactersCharacterIdWalletTransactions200OkList, 0, 0)
    31  			} else {
    32  				*out = GetCharactersCharacterIdWalletTransactions200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdWalletTransactions200Ok
    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 easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdWalletTransactions200OkList) {
    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 GetCharactersCharacterIdWalletTransactions200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdWalletTransactions200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdWalletTransactions200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdWalletTransactions200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdWalletTransactions200Ok) {
    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 "client_id":
   107  			out.ClientId = int32(in.Int32())
   108  		case "date":
   109  			if data := in.Raw(); in.Ok() {
   110  				in.AddError((out.Date).UnmarshalJSON(data))
   111  			}
   112  		case "is_buy":
   113  			out.IsBuy = bool(in.Bool())
   114  		case "is_personal":
   115  			out.IsPersonal = bool(in.Bool())
   116  		case "journal_ref_id":
   117  			out.JournalRefId = int64(in.Int64())
   118  		case "location_id":
   119  			out.LocationId = int64(in.Int64())
   120  		case "quantity":
   121  			out.Quantity = int32(in.Int32())
   122  		case "transaction_id":
   123  			out.TransactionId = int64(in.Int64())
   124  		case "type_id":
   125  			out.TypeId = int32(in.Int32())
   126  		case "unit_price":
   127  			out.UnitPrice = float64(in.Float64())
   128  		default:
   129  			in.SkipRecursive()
   130  		}
   131  		in.WantComma()
   132  	}
   133  	in.Delim('}')
   134  	if isTopLevel {
   135  		in.Consumed()
   136  	}
   137  }
   138  func easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdWalletTransactions200Ok) {
   139  	out.RawByte('{')
   140  	first := true
   141  	_ = first
   142  	if in.ClientId != 0 {
   143  		const prefix string = ",\"client_id\":"
   144  		first = false
   145  		out.RawString(prefix[1:])
   146  		out.Int32(int32(in.ClientId))
   147  	}
   148  	if true {
   149  		const prefix string = ",\"date\":"
   150  		if first {
   151  			first = false
   152  			out.RawString(prefix[1:])
   153  		} else {
   154  			out.RawString(prefix)
   155  		}
   156  		out.Raw((in.Date).MarshalJSON())
   157  	}
   158  	if in.IsBuy {
   159  		const prefix string = ",\"is_buy\":"
   160  		if first {
   161  			first = false
   162  			out.RawString(prefix[1:])
   163  		} else {
   164  			out.RawString(prefix)
   165  		}
   166  		out.Bool(bool(in.IsBuy))
   167  	}
   168  	if in.IsPersonal {
   169  		const prefix string = ",\"is_personal\":"
   170  		if first {
   171  			first = false
   172  			out.RawString(prefix[1:])
   173  		} else {
   174  			out.RawString(prefix)
   175  		}
   176  		out.Bool(bool(in.IsPersonal))
   177  	}
   178  	if in.JournalRefId != 0 {
   179  		const prefix string = ",\"journal_ref_id\":"
   180  		if first {
   181  			first = false
   182  			out.RawString(prefix[1:])
   183  		} else {
   184  			out.RawString(prefix)
   185  		}
   186  		out.Int64(int64(in.JournalRefId))
   187  	}
   188  	if in.LocationId != 0 {
   189  		const prefix string = ",\"location_id\":"
   190  		if first {
   191  			first = false
   192  			out.RawString(prefix[1:])
   193  		} else {
   194  			out.RawString(prefix)
   195  		}
   196  		out.Int64(int64(in.LocationId))
   197  	}
   198  	if in.Quantity != 0 {
   199  		const prefix string = ",\"quantity\":"
   200  		if first {
   201  			first = false
   202  			out.RawString(prefix[1:])
   203  		} else {
   204  			out.RawString(prefix)
   205  		}
   206  		out.Int32(int32(in.Quantity))
   207  	}
   208  	if in.TransactionId != 0 {
   209  		const prefix string = ",\"transaction_id\":"
   210  		if first {
   211  			first = false
   212  			out.RawString(prefix[1:])
   213  		} else {
   214  			out.RawString(prefix)
   215  		}
   216  		out.Int64(int64(in.TransactionId))
   217  	}
   218  	if in.TypeId != 0 {
   219  		const prefix string = ",\"type_id\":"
   220  		if first {
   221  			first = false
   222  			out.RawString(prefix[1:])
   223  		} else {
   224  			out.RawString(prefix)
   225  		}
   226  		out.Int32(int32(in.TypeId))
   227  	}
   228  	if in.UnitPrice != 0 {
   229  		const prefix string = ",\"unit_price\":"
   230  		if first {
   231  			first = false
   232  			out.RawString(prefix[1:])
   233  		} else {
   234  			out.RawString(prefix)
   235  		}
   236  		out.Float64(float64(in.UnitPrice))
   237  	}
   238  	out.RawByte('}')
   239  }
   240  
   241  // MarshalJSON supports json.Marshaler interface
   242  func (v GetCharactersCharacterIdWalletTransactions200Ok) MarshalJSON() ([]byte, error) {
   243  	w := jwriter.Writer{}
   244  	easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi1(&w, v)
   245  	return w.Buffer.BuildBytes(), w.Error
   246  }
   247  
   248  // MarshalEasyJSON supports easyjson.Marshaler interface
   249  func (v GetCharactersCharacterIdWalletTransactions200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   250  	easyjsonD4ffa85dEncodeGithubComAntihaxGoesiEsi1(w, v)
   251  }
   252  
   253  // UnmarshalJSON supports json.Unmarshaler interface
   254  func (v *GetCharactersCharacterIdWalletTransactions200Ok) UnmarshalJSON(data []byte) error {
   255  	r := jlexer.Lexer{Data: data}
   256  	easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi1(&r, v)
   257  	return r.Error()
   258  }
   259  
   260  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   261  func (v *GetCharactersCharacterIdWalletTransactions200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   262  	easyjsonD4ffa85dDecodeGithubComAntihaxGoesiEsi1(l, v)
   263  }