github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_wallet_journal_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 easyjson6c121645DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdWalletJournal200OkList) {
    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(GetCharactersCharacterIdWalletJournal200OkList, 0, 0)
    31  			} else {
    32  				*out = GetCharactersCharacterIdWalletJournal200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdWalletJournal200Ok
    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 easyjson6c121645EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdWalletJournal200OkList) {
    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 GetCharactersCharacterIdWalletJournal200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson6c121645EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdWalletJournal200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson6c121645EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdWalletJournal200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson6c121645DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdWalletJournal200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson6c121645DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson6c121645DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdWalletJournal200Ok) {
    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 "amount":
   107  			out.Amount = float64(in.Float64())
   108  		case "balance":
   109  			out.Balance = float64(in.Float64())
   110  		case "context_id":
   111  			out.ContextId = int64(in.Int64())
   112  		case "context_id_type":
   113  			out.ContextIdType = string(in.String())
   114  		case "date":
   115  			if data := in.Raw(); in.Ok() {
   116  				in.AddError((out.Date).UnmarshalJSON(data))
   117  			}
   118  		case "description":
   119  			out.Description = string(in.String())
   120  		case "first_party_id":
   121  			out.FirstPartyId = int32(in.Int32())
   122  		case "id":
   123  			out.Id = int64(in.Int64())
   124  		case "reason":
   125  			out.Reason = string(in.String())
   126  		case "ref_type":
   127  			out.RefType = string(in.String())
   128  		case "second_party_id":
   129  			out.SecondPartyId = int32(in.Int32())
   130  		case "tax":
   131  			out.Tax = float64(in.Float64())
   132  		case "tax_receiver_id":
   133  			out.TaxReceiverId = int32(in.Int32())
   134  		default:
   135  			in.SkipRecursive()
   136  		}
   137  		in.WantComma()
   138  	}
   139  	in.Delim('}')
   140  	if isTopLevel {
   141  		in.Consumed()
   142  	}
   143  }
   144  func easyjson6c121645EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdWalletJournal200Ok) {
   145  	out.RawByte('{')
   146  	first := true
   147  	_ = first
   148  	if in.Amount != 0 {
   149  		const prefix string = ",\"amount\":"
   150  		first = false
   151  		out.RawString(prefix[1:])
   152  		out.Float64(float64(in.Amount))
   153  	}
   154  	if in.Balance != 0 {
   155  		const prefix string = ",\"balance\":"
   156  		if first {
   157  			first = false
   158  			out.RawString(prefix[1:])
   159  		} else {
   160  			out.RawString(prefix)
   161  		}
   162  		out.Float64(float64(in.Balance))
   163  	}
   164  	if in.ContextId != 0 {
   165  		const prefix string = ",\"context_id\":"
   166  		if first {
   167  			first = false
   168  			out.RawString(prefix[1:])
   169  		} else {
   170  			out.RawString(prefix)
   171  		}
   172  		out.Int64(int64(in.ContextId))
   173  	}
   174  	if in.ContextIdType != "" {
   175  		const prefix string = ",\"context_id_type\":"
   176  		if first {
   177  			first = false
   178  			out.RawString(prefix[1:])
   179  		} else {
   180  			out.RawString(prefix)
   181  		}
   182  		out.String(string(in.ContextIdType))
   183  	}
   184  	if true {
   185  		const prefix string = ",\"date\":"
   186  		if first {
   187  			first = false
   188  			out.RawString(prefix[1:])
   189  		} else {
   190  			out.RawString(prefix)
   191  		}
   192  		out.Raw((in.Date).MarshalJSON())
   193  	}
   194  	if in.Description != "" {
   195  		const prefix string = ",\"description\":"
   196  		if first {
   197  			first = false
   198  			out.RawString(prefix[1:])
   199  		} else {
   200  			out.RawString(prefix)
   201  		}
   202  		out.String(string(in.Description))
   203  	}
   204  	if in.FirstPartyId != 0 {
   205  		const prefix string = ",\"first_party_id\":"
   206  		if first {
   207  			first = false
   208  			out.RawString(prefix[1:])
   209  		} else {
   210  			out.RawString(prefix)
   211  		}
   212  		out.Int32(int32(in.FirstPartyId))
   213  	}
   214  	if in.Id != 0 {
   215  		const prefix string = ",\"id\":"
   216  		if first {
   217  			first = false
   218  			out.RawString(prefix[1:])
   219  		} else {
   220  			out.RawString(prefix)
   221  		}
   222  		out.Int64(int64(in.Id))
   223  	}
   224  	if in.Reason != "" {
   225  		const prefix string = ",\"reason\":"
   226  		if first {
   227  			first = false
   228  			out.RawString(prefix[1:])
   229  		} else {
   230  			out.RawString(prefix)
   231  		}
   232  		out.String(string(in.Reason))
   233  	}
   234  	if in.RefType != "" {
   235  		const prefix string = ",\"ref_type\":"
   236  		if first {
   237  			first = false
   238  			out.RawString(prefix[1:])
   239  		} else {
   240  			out.RawString(prefix)
   241  		}
   242  		out.String(string(in.RefType))
   243  	}
   244  	if in.SecondPartyId != 0 {
   245  		const prefix string = ",\"second_party_id\":"
   246  		if first {
   247  			first = false
   248  			out.RawString(prefix[1:])
   249  		} else {
   250  			out.RawString(prefix)
   251  		}
   252  		out.Int32(int32(in.SecondPartyId))
   253  	}
   254  	if in.Tax != 0 {
   255  		const prefix string = ",\"tax\":"
   256  		if first {
   257  			first = false
   258  			out.RawString(prefix[1:])
   259  		} else {
   260  			out.RawString(prefix)
   261  		}
   262  		out.Float64(float64(in.Tax))
   263  	}
   264  	if in.TaxReceiverId != 0 {
   265  		const prefix string = ",\"tax_receiver_id\":"
   266  		if first {
   267  			first = false
   268  			out.RawString(prefix[1:])
   269  		} else {
   270  			out.RawString(prefix)
   271  		}
   272  		out.Int32(int32(in.TaxReceiverId))
   273  	}
   274  	out.RawByte('}')
   275  }
   276  
   277  // MarshalJSON supports json.Marshaler interface
   278  func (v GetCharactersCharacterIdWalletJournal200Ok) MarshalJSON() ([]byte, error) {
   279  	w := jwriter.Writer{}
   280  	easyjson6c121645EncodeGithubComAntihaxGoesiEsi1(&w, v)
   281  	return w.Buffer.BuildBytes(), w.Error
   282  }
   283  
   284  // MarshalEasyJSON supports easyjson.Marshaler interface
   285  func (v GetCharactersCharacterIdWalletJournal200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   286  	easyjson6c121645EncodeGithubComAntihaxGoesiEsi1(w, v)
   287  }
   288  
   289  // UnmarshalJSON supports json.Unmarshaler interface
   290  func (v *GetCharactersCharacterIdWalletJournal200Ok) UnmarshalJSON(data []byte) error {
   291  	r := jlexer.Lexer{Data: data}
   292  	easyjson6c121645DecodeGithubComAntihaxGoesiEsi1(&r, v)
   293  	return r.Error()
   294  }
   295  
   296  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   297  func (v *GetCharactersCharacterIdWalletJournal200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   298  	easyjson6c121645DecodeGithubComAntihaxGoesiEsi1(l, v)
   299  }