github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_post_universe_names_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 easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *PostUniverseNames200OkList) {
    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(PostUniverseNames200OkList, 0, 1)
    31  			} else {
    32  				*out = PostUniverseNames200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 PostUniverseNames200Ok
    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 easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in PostUniverseNames200OkList) {
    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 PostUniverseNames200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v PostUniverseNames200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *PostUniverseNames200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *PostUniverseNames200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *PostUniverseNames200Ok) {
    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 "category":
   107  			out.Category = string(in.String())
   108  		case "id":
   109  			out.Id = int32(in.Int32())
   110  		case "name":
   111  			out.Name = string(in.String())
   112  		default:
   113  			in.SkipRecursive()
   114  		}
   115  		in.WantComma()
   116  	}
   117  	in.Delim('}')
   118  	if isTopLevel {
   119  		in.Consumed()
   120  	}
   121  }
   122  func easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in PostUniverseNames200Ok) {
   123  	out.RawByte('{')
   124  	first := true
   125  	_ = first
   126  	if in.Category != "" {
   127  		const prefix string = ",\"category\":"
   128  		first = false
   129  		out.RawString(prefix[1:])
   130  		out.String(string(in.Category))
   131  	}
   132  	if in.Id != 0 {
   133  		const prefix string = ",\"id\":"
   134  		if first {
   135  			first = false
   136  			out.RawString(prefix[1:])
   137  		} else {
   138  			out.RawString(prefix)
   139  		}
   140  		out.Int32(int32(in.Id))
   141  	}
   142  	if in.Name != "" {
   143  		const prefix string = ",\"name\":"
   144  		if first {
   145  			first = false
   146  			out.RawString(prefix[1:])
   147  		} else {
   148  			out.RawString(prefix)
   149  		}
   150  		out.String(string(in.Name))
   151  	}
   152  	out.RawByte('}')
   153  }
   154  
   155  // MarshalJSON supports json.Marshaler interface
   156  func (v PostUniverseNames200Ok) MarshalJSON() ([]byte, error) {
   157  	w := jwriter.Writer{}
   158  	easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi1(&w, v)
   159  	return w.Buffer.BuildBytes(), w.Error
   160  }
   161  
   162  // MarshalEasyJSON supports easyjson.Marshaler interface
   163  func (v PostUniverseNames200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   164  	easyjsonC7ff5cd1EncodeGithubComAntihaxGoesiEsi1(w, v)
   165  }
   166  
   167  // UnmarshalJSON supports json.Unmarshaler interface
   168  func (v *PostUniverseNames200Ok) UnmarshalJSON(data []byte) error {
   169  	r := jlexer.Lexer{Data: data}
   170  	easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi1(&r, v)
   171  	return r.Error()
   172  }
   173  
   174  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   175  func (v *PostUniverseNames200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   176  	easyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi1(l, v)
   177  }