github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_skills_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 easyjson275affcbDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdSkillsOkList) {
    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(GetCharactersCharacterIdSkillsOkList, 0, 1)
    31  			} else {
    32  				*out = GetCharactersCharacterIdSkillsOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdSkillsOk
    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 easyjson275affcbEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdSkillsOkList) {
    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 GetCharactersCharacterIdSkillsOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson275affcbEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdSkillsOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson275affcbEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdSkillsOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson275affcbDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdSkillsOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson275affcbDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson275affcbDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdSkillsOk) {
    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 "skills":
   107  			if in.IsNull() {
   108  				in.Skip()
   109  				out.Skills = nil
   110  			} else {
   111  				in.Delim('[')
   112  				if out.Skills == nil {
   113  					if !in.IsDelim(']') {
   114  						out.Skills = make([]GetCharactersCharacterIdSkillsSkill, 0, 2)
   115  					} else {
   116  						out.Skills = []GetCharactersCharacterIdSkillsSkill{}
   117  					}
   118  				} else {
   119  					out.Skills = (out.Skills)[:0]
   120  				}
   121  				for !in.IsDelim(']') {
   122  					var v4 GetCharactersCharacterIdSkillsSkill
   123  					(v4).UnmarshalEasyJSON(in)
   124  					out.Skills = append(out.Skills, v4)
   125  					in.WantComma()
   126  				}
   127  				in.Delim(']')
   128  			}
   129  		case "total_sp":
   130  			out.TotalSp = int64(in.Int64())
   131  		case "unallocated_sp":
   132  			out.UnallocatedSp = int32(in.Int32())
   133  		default:
   134  			in.SkipRecursive()
   135  		}
   136  		in.WantComma()
   137  	}
   138  	in.Delim('}')
   139  	if isTopLevel {
   140  		in.Consumed()
   141  	}
   142  }
   143  func easyjson275affcbEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdSkillsOk) {
   144  	out.RawByte('{')
   145  	first := true
   146  	_ = first
   147  	if len(in.Skills) != 0 {
   148  		const prefix string = ",\"skills\":"
   149  		first = false
   150  		out.RawString(prefix[1:])
   151  		{
   152  			out.RawByte('[')
   153  			for v5, v6 := range in.Skills {
   154  				if v5 > 0 {
   155  					out.RawByte(',')
   156  				}
   157  				(v6).MarshalEasyJSON(out)
   158  			}
   159  			out.RawByte(']')
   160  		}
   161  	}
   162  	if in.TotalSp != 0 {
   163  		const prefix string = ",\"total_sp\":"
   164  		if first {
   165  			first = false
   166  			out.RawString(prefix[1:])
   167  		} else {
   168  			out.RawString(prefix)
   169  		}
   170  		out.Int64(int64(in.TotalSp))
   171  	}
   172  	if in.UnallocatedSp != 0 {
   173  		const prefix string = ",\"unallocated_sp\":"
   174  		if first {
   175  			first = false
   176  			out.RawString(prefix[1:])
   177  		} else {
   178  			out.RawString(prefix)
   179  		}
   180  		out.Int32(int32(in.UnallocatedSp))
   181  	}
   182  	out.RawByte('}')
   183  }
   184  
   185  // MarshalJSON supports json.Marshaler interface
   186  func (v GetCharactersCharacterIdSkillsOk) MarshalJSON() ([]byte, error) {
   187  	w := jwriter.Writer{}
   188  	easyjson275affcbEncodeGithubComAntihaxGoesiEsi1(&w, v)
   189  	return w.Buffer.BuildBytes(), w.Error
   190  }
   191  
   192  // MarshalEasyJSON supports easyjson.Marshaler interface
   193  func (v GetCharactersCharacterIdSkillsOk) MarshalEasyJSON(w *jwriter.Writer) {
   194  	easyjson275affcbEncodeGithubComAntihaxGoesiEsi1(w, v)
   195  }
   196  
   197  // UnmarshalJSON supports json.Unmarshaler interface
   198  func (v *GetCharactersCharacterIdSkillsOk) UnmarshalJSON(data []byte) error {
   199  	r := jlexer.Lexer{Data: data}
   200  	easyjson275affcbDecodeGithubComAntihaxGoesiEsi1(&r, v)
   201  	return r.Error()
   202  }
   203  
   204  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   205  func (v *GetCharactersCharacterIdSkillsOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   206  	easyjson275affcbDecodeGithubComAntihaxGoesiEsi1(l, v)
   207  }