github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/meta/model_get_status_item_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package meta
     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 easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta(in *jlexer.Lexer, out *GetStatusItemList) {
    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(GetStatusItemList, 0, 0)
    31  			} else {
    32  				*out = GetStatusItemList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetStatusItem
    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 easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta(out *jwriter.Writer, in GetStatusItemList) {
    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 GetStatusItemList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetStatusItemList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetStatusItemList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetStatusItemList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta(l, v)
    86  }
    87  func easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta1(in *jlexer.Lexer, out *GetStatusItem) {
    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 "endpoint":
   107  			out.Endpoint = string(in.String())
   108  		case "method":
   109  			out.Method = string(in.String())
   110  		case "route":
   111  			out.Route = string(in.String())
   112  		case "status":
   113  			out.Status = string(in.String())
   114  		case "tags":
   115  			if in.IsNull() {
   116  				in.Skip()
   117  				out.Tags = nil
   118  			} else {
   119  				in.Delim('[')
   120  				if out.Tags == nil {
   121  					if !in.IsDelim(']') {
   122  						out.Tags = make([]string, 0, 4)
   123  					} else {
   124  						out.Tags = []string{}
   125  					}
   126  				} else {
   127  					out.Tags = (out.Tags)[:0]
   128  				}
   129  				for !in.IsDelim(']') {
   130  					var v4 string
   131  					v4 = string(in.String())
   132  					out.Tags = append(out.Tags, v4)
   133  					in.WantComma()
   134  				}
   135  				in.Delim(']')
   136  			}
   137  		default:
   138  			in.SkipRecursive()
   139  		}
   140  		in.WantComma()
   141  	}
   142  	in.Delim('}')
   143  	if isTopLevel {
   144  		in.Consumed()
   145  	}
   146  }
   147  func easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta1(out *jwriter.Writer, in GetStatusItem) {
   148  	out.RawByte('{')
   149  	first := true
   150  	_ = first
   151  	if in.Endpoint != "" {
   152  		const prefix string = ",\"endpoint\":"
   153  		first = false
   154  		out.RawString(prefix[1:])
   155  		out.String(string(in.Endpoint))
   156  	}
   157  	if in.Method != "" {
   158  		const prefix string = ",\"method\":"
   159  		if first {
   160  			first = false
   161  			out.RawString(prefix[1:])
   162  		} else {
   163  			out.RawString(prefix)
   164  		}
   165  		out.String(string(in.Method))
   166  	}
   167  	if in.Route != "" {
   168  		const prefix string = ",\"route\":"
   169  		if first {
   170  			first = false
   171  			out.RawString(prefix[1:])
   172  		} else {
   173  			out.RawString(prefix)
   174  		}
   175  		out.String(string(in.Route))
   176  	}
   177  	if in.Status != "" {
   178  		const prefix string = ",\"status\":"
   179  		if first {
   180  			first = false
   181  			out.RawString(prefix[1:])
   182  		} else {
   183  			out.RawString(prefix)
   184  		}
   185  		out.String(string(in.Status))
   186  	}
   187  	if len(in.Tags) != 0 {
   188  		const prefix string = ",\"tags\":"
   189  		if first {
   190  			first = false
   191  			out.RawString(prefix[1:])
   192  		} else {
   193  			out.RawString(prefix)
   194  		}
   195  		{
   196  			out.RawByte('[')
   197  			for v5, v6 := range in.Tags {
   198  				if v5 > 0 {
   199  					out.RawByte(',')
   200  				}
   201  				out.String(string(v6))
   202  			}
   203  			out.RawByte(']')
   204  		}
   205  	}
   206  	out.RawByte('}')
   207  }
   208  
   209  // MarshalJSON supports json.Marshaler interface
   210  func (v GetStatusItem) MarshalJSON() ([]byte, error) {
   211  	w := jwriter.Writer{}
   212  	easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta1(&w, v)
   213  	return w.Buffer.BuildBytes(), w.Error
   214  }
   215  
   216  // MarshalEasyJSON supports easyjson.Marshaler interface
   217  func (v GetStatusItem) MarshalEasyJSON(w *jwriter.Writer) {
   218  	easyjson3c44e3bdEncodeGithubComAntihaxGoesiMeta1(w, v)
   219  }
   220  
   221  // UnmarshalJSON supports json.Unmarshaler interface
   222  func (v *GetStatusItem) UnmarshalJSON(data []byte) error {
   223  	r := jlexer.Lexer{Data: data}
   224  	easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta1(&r, v)
   225  	return r.Error()
   226  }
   227  
   228  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   229  func (v *GetStatusItem) UnmarshalEasyJSON(l *jlexer.Lexer) {
   230  	easyjson3c44e3bdDecodeGithubComAntihaxGoesiMeta1(l, v)
   231  }