pkg/helper/meta_helper_easyjson.go (281 lines of code) (raw):

// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. package helper import ( json "encoding/json" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" ) // suppress unused package warning var ( _ *json.RawMessage _ *jlexer.Lexer _ *jwriter.Writer _ easyjson.Marshaler ) func easyjson507f231cDecodeAwesomeProjectHelper(in *jlexer.Lexer, out *Parents) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() *out = nil } else { in.Delim('[') if *out == nil { if !in.IsDelim(']') { *out = make(Parents, 0, 4) } else { *out = Parents{} } } else { *out = (*out)[:0] } for !in.IsDelim(']') { var v1 string v1 = string(in.String()) *out = append(*out, v1) in.WantComma() } in.Delim(']') } if isTopLevel { in.Consumed() } } func easyjson507f231cEncodeAwesomeProjectHelper(out *jwriter.Writer, in Parents) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') for v2, v3 := range in { if v2 > 0 { out.RawByte(',') } out.String(string(v3)) } out.RawByte(']') } } // MarshalJSON supports json.Marshaler interface func (v Parents) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson507f231cEncodeAwesomeProjectHelper(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Parents) MarshalEasyJSON(w *jwriter.Writer) { easyjson507f231cEncodeAwesomeProjectHelper(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Parents) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson507f231cDecodeAwesomeProjectHelper(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Parents) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson507f231cDecodeAwesomeProjectHelper(l, v) } func easyjson507f231cDecodeAwesomeProjectHelper1(in *jlexer.Lexer, out *MetaNode) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "ID": out.ID = string(in.String()) case "Type": out.Type = string(in.String()) case "Attributes": (out.Attributes).UnmarshalEasyJSON(in) case "Labels": (out.Labels).UnmarshalEasyJSON(in) case "Parents": (out.Parents).UnmarshalEasyJSON(in) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjson507f231cEncodeAwesomeProjectHelper1(out *jwriter.Writer, in MetaNode) { out.RawByte('{') first := true _ = first { const prefix string = ",\"ID\":" out.RawString(prefix[1:]) out.String(string(in.ID)) } { const prefix string = ",\"Type\":" out.RawString(prefix) out.String(string(in.Type)) } { const prefix string = ",\"Attributes\":" out.RawString(prefix) (in.Attributes).MarshalEasyJSON(out) } { const prefix string = ",\"Labels\":" out.RawString(prefix) (in.Labels).MarshalEasyJSON(out) } { const prefix string = ",\"Parents\":" out.RawString(prefix) (in.Parents).MarshalEasyJSON(out) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v MetaNode) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson507f231cEncodeAwesomeProjectHelper1(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v MetaNode) MarshalEasyJSON(w *jwriter.Writer) { easyjson507f231cEncodeAwesomeProjectHelper1(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *MetaNode) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson507f231cDecodeAwesomeProjectHelper1(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *MetaNode) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson507f231cDecodeAwesomeProjectHelper1(l, v) } func easyjson507f231cDecodeAwesomeProjectHelper2(in *jlexer.Lexer, out *Labels) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() } else { in.Delim('{') *out = make(Labels) for !in.IsDelim('}') { key := string(in.String()) in.WantColon() var v4 string v4 = string(in.String()) (*out)[key] = v4 in.WantComma() } in.Delim('}') } if isTopLevel { in.Consumed() } } func easyjson507f231cEncodeAwesomeProjectHelper2(out *jwriter.Writer, in Labels) { if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { out.RawString(`null`) } else { out.RawByte('{') v5First := true for v5Name, v5Value := range in { if v5First { v5First = false } else { out.RawByte(',') } out.String(string(v5Name)) out.RawByte(':') out.String(string(v5Value)) } out.RawByte('}') } } // MarshalJSON supports json.Marshaler interface func (v Labels) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson507f231cEncodeAwesomeProjectHelper2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Labels) MarshalEasyJSON(w *jwriter.Writer) { easyjson507f231cEncodeAwesomeProjectHelper2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Labels) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson507f231cDecodeAwesomeProjectHelper2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Labels) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson507f231cDecodeAwesomeProjectHelper2(l, v) } func easyjson507f231cDecodeAwesomeProjectHelper3(in *jlexer.Lexer, out *Attributes) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() } else { in.Delim('{') *out = make(Attributes) for !in.IsDelim('}') { key := string(in.String()) in.WantColon() var v6 interface{} if m, ok := v6.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v6.(json.Unmarshaler); ok { _ = m.UnmarshalJSON(in.Raw()) } else { v6 = in.Interface() } (*out)[key] = v6 in.WantComma() } in.Delim('}') } if isTopLevel { in.Consumed() } } func easyjson507f231cEncodeAwesomeProjectHelper3(out *jwriter.Writer, in Attributes) { if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { out.RawString(`null`) } else { out.RawByte('{') v7First := true for v7Name, v7Value := range in { if v7First { v7First = false } else { out.RawByte(',') } out.String(string(v7Name)) out.RawByte(':') if m, ok := v7Value.(easyjson.Marshaler); ok { m.MarshalEasyJSON(out) } else if m, ok := v7Value.(json.Marshaler); ok { out.Raw(m.MarshalJSON()) } else { out.Raw(json.Marshal(v7Value)) } } out.RawByte('}') } } // MarshalJSON supports json.Marshaler interface func (v Attributes) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson507f231cEncodeAwesomeProjectHelper3(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Attributes) MarshalEasyJSON(w *jwriter.Writer) { easyjson507f231cEncodeAwesomeProjectHelper3(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Attributes) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson507f231cDecodeAwesomeProjectHelper3(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Attributes) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson507f231cDecodeAwesomeProjectHelper3(l, v) }