From 3400803672252bd6a5505719105d04dafd4092b3 Mon Sep 17 00:00:00 2001 From: kongfei Date: Thu, 10 Nov 2022 12:41:16 +0800 Subject: [PATCH] regenerate easyjosn file for router_opentsdb --- src/server/router/router_opentsdb_easyjson.go | 221 ++++++++++++++++-- 1 file changed, 206 insertions(+), 15 deletions(-) diff --git a/src/server/router/router_opentsdb_easyjson.go b/src/server/router/router_opentsdb_easyjson.go index 468dedfb..8836e70e 100644 --- a/src/server/router/router_opentsdb_easyjson.go +++ b/src/server/router/router_opentsdb_easyjson.go @@ -1,23 +1,214 @@ -// TEMPORARY AUTOGENERATED FILE: easyjson stub code to make the package -// compilable during generation. +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. -package router +package router import ( - "github.com/mailru/easyjson/jwriter" - "github.com/mailru/easyjson/jlexer" + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" ) -func ( HTTPMetric ) MarshalJSON() ([]byte, error) { return nil, nil } -func (* HTTPMetric ) UnmarshalJSON([]byte) error { return nil } -func ( HTTPMetric ) MarshalEasyJSON(w *jwriter.Writer) {} -func (* HTTPMetric ) UnmarshalEasyJSON(l *jlexer.Lexer) {} +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) -type EasyJSON_exporter_HTTPMetric *HTTPMetric +func easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter(in *jlexer.Lexer, out *HTTPMetricArr) { + isTopLevel := in.IsStart() + if in.IsNull() { + in.Skip() + *out = nil + } else { + in.Delim('[') + if *out == nil { + if !in.IsDelim(']') { + *out = make(HTTPMetricArr, 0, 1) + } else { + *out = HTTPMetricArr{} + } + } else { + *out = (*out)[:0] + } + for !in.IsDelim(']') { + var v1 HTTPMetric + (v1).UnmarshalEasyJSON(in) + *out = append(*out, v1) + in.WantComma() + } + in.Delim(']') + } + if isTopLevel { + in.Consumed() + } +} +func easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter(out *jwriter.Writer, in HTTPMetricArr) { + if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in { + if v2 > 0 { + out.RawByte(',') + } + (v3).MarshalEasyJSON(out) + } + out.RawByte(']') + } +} -func ( HTTPMetricArr ) MarshalJSON() ([]byte, error) { return nil, nil } -func (* HTTPMetricArr ) UnmarshalJSON([]byte) error { return nil } -func ( HTTPMetricArr ) MarshalEasyJSON(w *jwriter.Writer) {} -func (* HTTPMetricArr ) UnmarshalEasyJSON(l *jlexer.Lexer) {} +// MarshalJSON supports json.Marshaler interface +func (v HTTPMetricArr) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter(&w, v) + return w.Buffer.BuildBytes(), w.Error +} -type EasyJSON_exporter_HTTPMetricArr *HTTPMetricArr +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v HTTPMetricArr) MarshalEasyJSON(w *jwriter.Writer) { + easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *HTTPMetricArr) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *HTTPMetricArr) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter(l, v) +} +func easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter1(in *jlexer.Lexer, out *HTTPMetric) { + 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 "metric": + out.Metric = string(in.String()) + case "timestamp": + out.Timestamp = int64(in.Int64()) + case "value": + if m, ok := out.ValueUnTyped.(easyjson.Unmarshaler); ok { + m.UnmarshalEasyJSON(in) + } else if m, ok := out.ValueUnTyped.(json.Unmarshaler); ok { + _ = m.UnmarshalJSON(in.Raw()) + } else { + out.ValueUnTyped = in.Interface() + } + case "tags": + if in.IsNull() { + in.Skip() + } else { + in.Delim('{') + out.Tags = make(map[string]string) + for !in.IsDelim('}') { + key := string(in.String()) + in.WantColon() + var v4 string + v4 = string(in.String()) + (out.Tags)[key] = v4 + in.WantComma() + } + in.Delim('}') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter1(out *jwriter.Writer, in HTTPMetric) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"metric\":" + out.RawString(prefix[1:]) + out.String(string(in.Metric)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Int64(int64(in.Timestamp)) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + if m, ok := in.ValueUnTyped.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := in.ValueUnTyped.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(in.ValueUnTyped)) + } + } + { + const prefix string = ",\"tags\":" + out.RawString(prefix) + if in.Tags == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { + out.RawString(`null`) + } else { + out.RawByte('{') + v5First := true + for v5Name, v5Value := range in.Tags { + if v5First { + v5First = false + } else { + out.RawByte(',') + } + out.String(string(v5Name)) + out.RawByte(':') + out.String(string(v5Value)) + } + out.RawByte('}') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v HTTPMetric) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v HTTPMetric) MarshalEasyJSON(w *jwriter.Writer) { + easyjson30864de9EncodeGithubComDidiNightingaleV5SrcServerRouter1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *HTTPMetric) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *HTTPMetric) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson30864de9DecodeGithubComDidiNightingaleV5SrcServerRouter1(l, v) +}