github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_online_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 easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdOnlineOkList) {
    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(GetCharactersCharacterIdOnlineOkList, 0, 1)
    31  			} else {
    32  				*out = GetCharactersCharacterIdOnlineOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdOnlineOk
    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 easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdOnlineOkList) {
    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 GetCharactersCharacterIdOnlineOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdOnlineOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdOnlineOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdOnlineOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdOnlineOk) {
    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 "last_login":
   107  			if data := in.Raw(); in.Ok() {
   108  				in.AddError((out.LastLogin).UnmarshalJSON(data))
   109  			}
   110  		case "last_logout":
   111  			if data := in.Raw(); in.Ok() {
   112  				in.AddError((out.LastLogout).UnmarshalJSON(data))
   113  			}
   114  		case "logins":
   115  			out.Logins = int32(in.Int32())
   116  		case "online":
   117  			out.Online = bool(in.Bool())
   118  		default:
   119  			in.SkipRecursive()
   120  		}
   121  		in.WantComma()
   122  	}
   123  	in.Delim('}')
   124  	if isTopLevel {
   125  		in.Consumed()
   126  	}
   127  }
   128  func easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdOnlineOk) {
   129  	out.RawByte('{')
   130  	first := true
   131  	_ = first
   132  	if true {
   133  		const prefix string = ",\"last_login\":"
   134  		first = false
   135  		out.RawString(prefix[1:])
   136  		out.Raw((in.LastLogin).MarshalJSON())
   137  	}
   138  	if true {
   139  		const prefix string = ",\"last_logout\":"
   140  		if first {
   141  			first = false
   142  			out.RawString(prefix[1:])
   143  		} else {
   144  			out.RawString(prefix)
   145  		}
   146  		out.Raw((in.LastLogout).MarshalJSON())
   147  	}
   148  	if in.Logins != 0 {
   149  		const prefix string = ",\"logins\":"
   150  		if first {
   151  			first = false
   152  			out.RawString(prefix[1:])
   153  		} else {
   154  			out.RawString(prefix)
   155  		}
   156  		out.Int32(int32(in.Logins))
   157  	}
   158  	if in.Online {
   159  		const prefix string = ",\"online\":"
   160  		if first {
   161  			first = false
   162  			out.RawString(prefix[1:])
   163  		} else {
   164  			out.RawString(prefix)
   165  		}
   166  		out.Bool(bool(in.Online))
   167  	}
   168  	out.RawByte('}')
   169  }
   170  
   171  // MarshalJSON supports json.Marshaler interface
   172  func (v GetCharactersCharacterIdOnlineOk) MarshalJSON() ([]byte, error) {
   173  	w := jwriter.Writer{}
   174  	easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi1(&w, v)
   175  	return w.Buffer.BuildBytes(), w.Error
   176  }
   177  
   178  // MarshalEasyJSON supports easyjson.Marshaler interface
   179  func (v GetCharactersCharacterIdOnlineOk) MarshalEasyJSON(w *jwriter.Writer) {
   180  	easyjson93c87c1aEncodeGithubComAntihaxGoesiEsi1(w, v)
   181  }
   182  
   183  // UnmarshalJSON supports json.Unmarshaler interface
   184  func (v *GetCharactersCharacterIdOnlineOk) UnmarshalJSON(data []byte) error {
   185  	r := jlexer.Lexer{Data: data}
   186  	easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi1(&r, v)
   187  	return r.Error()
   188  }
   189  
   190  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   191  func (v *GetCharactersCharacterIdOnlineOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   192  	easyjson93c87c1aDecodeGithubComAntihaxGoesiEsi1(l, v)
   193  }