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