github.com/alibaba/ilogtail/pkg@v0.0.0-20250526110833-c53b480d046c/helper/meta_helper_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package helper
     4  
     5  import (
     6  	json "encoding/json"
     7  	easyjson "github.com/mailru/easyjson"
     8  	jlexer "github.com/mailru/easyjson/jlexer"
     9  	jwriter "github.com/mailru/easyjson/jwriter"
    10  )
    11  
    12  // suppress unused package warning
    13  var (
    14  	_ *json.RawMessage
    15  	_ *jlexer.Lexer
    16  	_ *jwriter.Writer
    17  	_ easyjson.Marshaler
    18  )
    19  
    20  func easyjson507f231cDecodeAwesomeProjectHelper(in *jlexer.Lexer, out *Parents) {
    21  	isTopLevel := in.IsStart()
    22  	if in.IsNull() {
    23  		in.Skip()
    24  		*out = nil
    25  	} else {
    26  		in.Delim('[')
    27  		if *out == nil {
    28  			if !in.IsDelim(']') {
    29  				*out = make(Parents, 0, 4)
    30  			} else {
    31  				*out = Parents{}
    32  			}
    33  		} else {
    34  			*out = (*out)[:0]
    35  		}
    36  		for !in.IsDelim(']') {
    37  			var v1 string
    38  			v1 = string(in.String())
    39  			*out = append(*out, v1)
    40  			in.WantComma()
    41  		}
    42  		in.Delim(']')
    43  	}
    44  	if isTopLevel {
    45  		in.Consumed()
    46  	}
    47  }
    48  func easyjson507f231cEncodeAwesomeProjectHelper(out *jwriter.Writer, in Parents) {
    49  	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
    50  		out.RawString("null")
    51  	} else {
    52  		out.RawByte('[')
    53  		for v2, v3 := range in {
    54  			if v2 > 0 {
    55  				out.RawByte(',')
    56  			}
    57  			out.String(string(v3))
    58  		}
    59  		out.RawByte(']')
    60  	}
    61  }
    62  
    63  // MarshalJSON supports json.Marshaler interface
    64  func (v Parents) MarshalJSON() ([]byte, error) {
    65  	w := jwriter.Writer{}
    66  	easyjson507f231cEncodeAwesomeProjectHelper(&w, v)
    67  	return w.Buffer.BuildBytes(), w.Error
    68  }
    69  
    70  // MarshalEasyJSON supports easyjson.Marshaler interface
    71  func (v Parents) MarshalEasyJSON(w *jwriter.Writer) {
    72  	easyjson507f231cEncodeAwesomeProjectHelper(w, v)
    73  }
    74  
    75  // UnmarshalJSON supports json.Unmarshaler interface
    76  func (v *Parents) UnmarshalJSON(data []byte) error {
    77  	r := jlexer.Lexer{Data: data}
    78  	easyjson507f231cDecodeAwesomeProjectHelper(&r, v)
    79  	return r.Error()
    80  }
    81  
    82  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    83  func (v *Parents) UnmarshalEasyJSON(l *jlexer.Lexer) {
    84  	easyjson507f231cDecodeAwesomeProjectHelper(l, v)
    85  }
    86  func easyjson507f231cDecodeAwesomeProjectHelper1(in *jlexer.Lexer, out *MetaNode) {
    87  	isTopLevel := in.IsStart()
    88  	if in.IsNull() {
    89  		if isTopLevel {
    90  			in.Consumed()
    91  		}
    92  		in.Skip()
    93  		return
    94  	}
    95  	in.Delim('{')
    96  	for !in.IsDelim('}') {
    97  		key := in.UnsafeFieldName(false)
    98  		in.WantColon()
    99  		if in.IsNull() {
   100  			in.Skip()
   101  			in.WantComma()
   102  			continue
   103  		}
   104  		switch key {
   105  		case "ID":
   106  			out.ID = string(in.String())
   107  		case "Type":
   108  			out.Type = string(in.String())
   109  		case "Attributes":
   110  			(out.Attributes).UnmarshalEasyJSON(in)
   111  		case "Labels":
   112  			(out.Labels).UnmarshalEasyJSON(in)
   113  		case "Parents":
   114  			(out.Parents).UnmarshalEasyJSON(in)
   115  		default:
   116  			in.SkipRecursive()
   117  		}
   118  		in.WantComma()
   119  	}
   120  	in.Delim('}')
   121  	if isTopLevel {
   122  		in.Consumed()
   123  	}
   124  }
   125  func easyjson507f231cEncodeAwesomeProjectHelper1(out *jwriter.Writer, in MetaNode) {
   126  	out.RawByte('{')
   127  	first := true
   128  	_ = first
   129  	{
   130  		const prefix string = ",\"ID\":"
   131  		out.RawString(prefix[1:])
   132  		out.String(string(in.ID))
   133  	}
   134  	{
   135  		const prefix string = ",\"Type\":"
   136  		out.RawString(prefix)
   137  		out.String(string(in.Type))
   138  	}
   139  	{
   140  		const prefix string = ",\"Attributes\":"
   141  		out.RawString(prefix)
   142  		(in.Attributes).MarshalEasyJSON(out)
   143  	}
   144  	{
   145  		const prefix string = ",\"Labels\":"
   146  		out.RawString(prefix)
   147  		(in.Labels).MarshalEasyJSON(out)
   148  	}
   149  	{
   150  		const prefix string = ",\"Parents\":"
   151  		out.RawString(prefix)
   152  		(in.Parents).MarshalEasyJSON(out)
   153  	}
   154  	out.RawByte('}')
   155  }
   156  
   157  // MarshalJSON supports json.Marshaler interface
   158  func (v MetaNode) MarshalJSON() ([]byte, error) {
   159  	w := jwriter.Writer{}
   160  	easyjson507f231cEncodeAwesomeProjectHelper1(&w, v)
   161  	return w.Buffer.BuildBytes(), w.Error
   162  }
   163  
   164  // MarshalEasyJSON supports easyjson.Marshaler interface
   165  func (v MetaNode) MarshalEasyJSON(w *jwriter.Writer) {
   166  	easyjson507f231cEncodeAwesomeProjectHelper1(w, v)
   167  }
   168  
   169  // UnmarshalJSON supports json.Unmarshaler interface
   170  func (v *MetaNode) UnmarshalJSON(data []byte) error {
   171  	r := jlexer.Lexer{Data: data}
   172  	easyjson507f231cDecodeAwesomeProjectHelper1(&r, v)
   173  	return r.Error()
   174  }
   175  
   176  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   177  func (v *MetaNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
   178  	easyjson507f231cDecodeAwesomeProjectHelper1(l, v)
   179  }
   180  func easyjson507f231cDecodeAwesomeProjectHelper2(in *jlexer.Lexer, out *Labels) {
   181  	isTopLevel := in.IsStart()
   182  	if in.IsNull() {
   183  		in.Skip()
   184  	} else {
   185  		in.Delim('{')
   186  		*out = make(Labels)
   187  		for !in.IsDelim('}') {
   188  			key := string(in.String())
   189  			in.WantColon()
   190  			var v4 string
   191  			v4 = string(in.String())
   192  			(*out)[key] = v4
   193  			in.WantComma()
   194  		}
   195  		in.Delim('}')
   196  	}
   197  	if isTopLevel {
   198  		in.Consumed()
   199  	}
   200  }
   201  func easyjson507f231cEncodeAwesomeProjectHelper2(out *jwriter.Writer, in Labels) {
   202  	if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
   203  		out.RawString(`null`)
   204  	} else {
   205  		out.RawByte('{')
   206  		v5First := true
   207  		for v5Name, v5Value := range in {
   208  			if v5First {
   209  				v5First = false
   210  			} else {
   211  				out.RawByte(',')
   212  			}
   213  			out.String(string(v5Name))
   214  			out.RawByte(':')
   215  			out.String(string(v5Value))
   216  		}
   217  		out.RawByte('}')
   218  	}
   219  }
   220  
   221  // MarshalJSON supports json.Marshaler interface
   222  func (v Labels) MarshalJSON() ([]byte, error) {
   223  	w := jwriter.Writer{}
   224  	easyjson507f231cEncodeAwesomeProjectHelper2(&w, v)
   225  	return w.Buffer.BuildBytes(), w.Error
   226  }
   227  
   228  // MarshalEasyJSON supports easyjson.Marshaler interface
   229  func (v Labels) MarshalEasyJSON(w *jwriter.Writer) {
   230  	easyjson507f231cEncodeAwesomeProjectHelper2(w, v)
   231  }
   232  
   233  // UnmarshalJSON supports json.Unmarshaler interface
   234  func (v *Labels) UnmarshalJSON(data []byte) error {
   235  	r := jlexer.Lexer{Data: data}
   236  	easyjson507f231cDecodeAwesomeProjectHelper2(&r, v)
   237  	return r.Error()
   238  }
   239  
   240  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   241  func (v *Labels) UnmarshalEasyJSON(l *jlexer.Lexer) {
   242  	easyjson507f231cDecodeAwesomeProjectHelper2(l, v)
   243  }
   244  func easyjson507f231cDecodeAwesomeProjectHelper3(in *jlexer.Lexer, out *Attributes) {
   245  	isTopLevel := in.IsStart()
   246  	if in.IsNull() {
   247  		in.Skip()
   248  	} else {
   249  		in.Delim('{')
   250  		*out = make(Attributes)
   251  		for !in.IsDelim('}') {
   252  			key := string(in.String())
   253  			in.WantColon()
   254  			var v6 interface{}
   255  			if m, ok := v6.(easyjson.Unmarshaler); ok {
   256  				m.UnmarshalEasyJSON(in)
   257  			} else if m, ok := v6.(json.Unmarshaler); ok {
   258  				_ = m.UnmarshalJSON(in.Raw())
   259  			} else {
   260  				v6 = in.Interface()
   261  			}
   262  			(*out)[key] = v6
   263  			in.WantComma()
   264  		}
   265  		in.Delim('}')
   266  	}
   267  	if isTopLevel {
   268  		in.Consumed()
   269  	}
   270  }
   271  func easyjson507f231cEncodeAwesomeProjectHelper3(out *jwriter.Writer, in Attributes) {
   272  	if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
   273  		out.RawString(`null`)
   274  	} else {
   275  		out.RawByte('{')
   276  		v7First := true
   277  		for v7Name, v7Value := range in {
   278  			if v7First {
   279  				v7First = false
   280  			} else {
   281  				out.RawByte(',')
   282  			}
   283  			out.String(string(v7Name))
   284  			out.RawByte(':')
   285  			if m, ok := v7Value.(easyjson.Marshaler); ok {
   286  				m.MarshalEasyJSON(out)
   287  			} else if m, ok := v7Value.(json.Marshaler); ok {
   288  				out.Raw(m.MarshalJSON())
   289  			} else {
   290  				out.Raw(json.Marshal(v7Value))
   291  			}
   292  		}
   293  		out.RawByte('}')
   294  	}
   295  }
   296  
   297  // MarshalJSON supports json.Marshaler interface
   298  func (v Attributes) MarshalJSON() ([]byte, error) {
   299  	w := jwriter.Writer{}
   300  	easyjson507f231cEncodeAwesomeProjectHelper3(&w, v)
   301  	return w.Buffer.BuildBytes(), w.Error
   302  }
   303  
   304  // MarshalEasyJSON supports easyjson.Marshaler interface
   305  func (v Attributes) MarshalEasyJSON(w *jwriter.Writer) {
   306  	easyjson507f231cEncodeAwesomeProjectHelper3(w, v)
   307  }
   308  
   309  // UnmarshalJSON supports json.Unmarshaler interface
   310  func (v *Attributes) UnmarshalJSON(data []byte) error {
   311  	r := jlexer.Lexer{Data: data}
   312  	easyjson507f231cDecodeAwesomeProjectHelper3(&r, v)
   313  	return r.Error()
   314  }
   315  
   316  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   317  func (v *Attributes) UnmarshalEasyJSON(l *jlexer.Lexer) {
   318  	easyjson507f231cDecodeAwesomeProjectHelper3(l, v)
   319  }