github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_opportunities_groups_group_id_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 easyjson2bed092DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetOpportunitiesGroupsGroupIdOkList) {
    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(GetOpportunitiesGroupsGroupIdOkList, 0, 0)
    31  			} else {
    32  				*out = GetOpportunitiesGroupsGroupIdOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetOpportunitiesGroupsGroupIdOk
    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 easyjson2bed092EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetOpportunitiesGroupsGroupIdOkList) {
    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 GetOpportunitiesGroupsGroupIdOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson2bed092EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetOpportunitiesGroupsGroupIdOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson2bed092EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetOpportunitiesGroupsGroupIdOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson2bed092DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetOpportunitiesGroupsGroupIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson2bed092DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson2bed092DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetOpportunitiesGroupsGroupIdOk) {
    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 "connected_groups":
   107  			if in.IsNull() {
   108  				in.Skip()
   109  				out.ConnectedGroups = nil
   110  			} else {
   111  				in.Delim('[')
   112  				if out.ConnectedGroups == nil {
   113  					if !in.IsDelim(']') {
   114  						out.ConnectedGroups = make([]int32, 0, 16)
   115  					} else {
   116  						out.ConnectedGroups = []int32{}
   117  					}
   118  				} else {
   119  					out.ConnectedGroups = (out.ConnectedGroups)[:0]
   120  				}
   121  				for !in.IsDelim(']') {
   122  					var v4 int32
   123  					v4 = int32(in.Int32())
   124  					out.ConnectedGroups = append(out.ConnectedGroups, v4)
   125  					in.WantComma()
   126  				}
   127  				in.Delim(']')
   128  			}
   129  		case "description":
   130  			out.Description = string(in.String())
   131  		case "group_id":
   132  			out.GroupId = int32(in.Int32())
   133  		case "name":
   134  			out.Name = string(in.String())
   135  		case "notification":
   136  			out.Notification = string(in.String())
   137  		case "required_tasks":
   138  			if in.IsNull() {
   139  				in.Skip()
   140  				out.RequiredTasks = nil
   141  			} else {
   142  				in.Delim('[')
   143  				if out.RequiredTasks == nil {
   144  					if !in.IsDelim(']') {
   145  						out.RequiredTasks = make([]int32, 0, 16)
   146  					} else {
   147  						out.RequiredTasks = []int32{}
   148  					}
   149  				} else {
   150  					out.RequiredTasks = (out.RequiredTasks)[:0]
   151  				}
   152  				for !in.IsDelim(']') {
   153  					var v5 int32
   154  					v5 = int32(in.Int32())
   155  					out.RequiredTasks = append(out.RequiredTasks, v5)
   156  					in.WantComma()
   157  				}
   158  				in.Delim(']')
   159  			}
   160  		default:
   161  			in.SkipRecursive()
   162  		}
   163  		in.WantComma()
   164  	}
   165  	in.Delim('}')
   166  	if isTopLevel {
   167  		in.Consumed()
   168  	}
   169  }
   170  func easyjson2bed092EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetOpportunitiesGroupsGroupIdOk) {
   171  	out.RawByte('{')
   172  	first := true
   173  	_ = first
   174  	if len(in.ConnectedGroups) != 0 {
   175  		const prefix string = ",\"connected_groups\":"
   176  		first = false
   177  		out.RawString(prefix[1:])
   178  		{
   179  			out.RawByte('[')
   180  			for v6, v7 := range in.ConnectedGroups {
   181  				if v6 > 0 {
   182  					out.RawByte(',')
   183  				}
   184  				out.Int32(int32(v7))
   185  			}
   186  			out.RawByte(']')
   187  		}
   188  	}
   189  	if in.Description != "" {
   190  		const prefix string = ",\"description\":"
   191  		if first {
   192  			first = false
   193  			out.RawString(prefix[1:])
   194  		} else {
   195  			out.RawString(prefix)
   196  		}
   197  		out.String(string(in.Description))
   198  	}
   199  	if in.GroupId != 0 {
   200  		const prefix string = ",\"group_id\":"
   201  		if first {
   202  			first = false
   203  			out.RawString(prefix[1:])
   204  		} else {
   205  			out.RawString(prefix)
   206  		}
   207  		out.Int32(int32(in.GroupId))
   208  	}
   209  	if in.Name != "" {
   210  		const prefix string = ",\"name\":"
   211  		if first {
   212  			first = false
   213  			out.RawString(prefix[1:])
   214  		} else {
   215  			out.RawString(prefix)
   216  		}
   217  		out.String(string(in.Name))
   218  	}
   219  	if in.Notification != "" {
   220  		const prefix string = ",\"notification\":"
   221  		if first {
   222  			first = false
   223  			out.RawString(prefix[1:])
   224  		} else {
   225  			out.RawString(prefix)
   226  		}
   227  		out.String(string(in.Notification))
   228  	}
   229  	if len(in.RequiredTasks) != 0 {
   230  		const prefix string = ",\"required_tasks\":"
   231  		if first {
   232  			first = false
   233  			out.RawString(prefix[1:])
   234  		} else {
   235  			out.RawString(prefix)
   236  		}
   237  		{
   238  			out.RawByte('[')
   239  			for v8, v9 := range in.RequiredTasks {
   240  				if v8 > 0 {
   241  					out.RawByte(',')
   242  				}
   243  				out.Int32(int32(v9))
   244  			}
   245  			out.RawByte(']')
   246  		}
   247  	}
   248  	out.RawByte('}')
   249  }
   250  
   251  // MarshalJSON supports json.Marshaler interface
   252  func (v GetOpportunitiesGroupsGroupIdOk) MarshalJSON() ([]byte, error) {
   253  	w := jwriter.Writer{}
   254  	easyjson2bed092EncodeGithubComAntihaxGoesiEsi1(&w, v)
   255  	return w.Buffer.BuildBytes(), w.Error
   256  }
   257  
   258  // MarshalEasyJSON supports easyjson.Marshaler interface
   259  func (v GetOpportunitiesGroupsGroupIdOk) MarshalEasyJSON(w *jwriter.Writer) {
   260  	easyjson2bed092EncodeGithubComAntihaxGoesiEsi1(w, v)
   261  }
   262  
   263  // UnmarshalJSON supports json.Unmarshaler interface
   264  func (v *GetOpportunitiesGroupsGroupIdOk) UnmarshalJSON(data []byte) error {
   265  	r := jlexer.Lexer{Data: data}
   266  	easyjson2bed092DecodeGithubComAntihaxGoesiEsi1(&r, v)
   267  	return r.Error()
   268  }
   269  
   270  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   271  func (v *GetOpportunitiesGroupsGroupIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   272  	easyjson2bed092DecodeGithubComAntihaxGoesiEsi1(l, v)
   273  }