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