Debian Codegraph @

benchmarks/small_payload_easyjson.go

raw
1 // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
2
3 package benchmark
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 easyjson21677a1cDecodeBenchmark(in *jlexer.Lexer, out *SmallPayloadEasyJson) {
21 isTopLevel := in.IsStart()
22 if in.IsNull() {
23 if isTopLevel {
24 in.Consumed()
25 }
26 in.Skip()
27 return
28 }
29 in.Delim('{')
30 for !in.IsDelim('}') {
31 key := in.UnsafeString()
32 in.WantColon()
33 if in.IsNull() {
34 in.Skip()
35 in.WantComma()
36 continue
37 }
38 switch key {
39 case "St":
40 out.St = int(in.Int())
41 case "Sid":
42 out.Sid = int(in.Int())
43 case "Tt":
44 out.Tt = string(in.String())
45 case "Gr":
46 out.Gr = int(in.Int())
47 case "Uuid":
48 out.Uuid = string(in.String())
49 case "Ip":
50 out.Ip = string(in.String())
51 case "Ua":
52 out.Ua = string(in.String())
53 case "Tz":
54 out.Tz = int(in.Int())
55 case "V":
56 out.V = int(in.Int())
57 default:
58 in.SkipRecursive()
59 }
60 in.WantComma()
61 }
62 in.Delim('}')
63 if isTopLevel {
64 in.Consumed()
65 }
66 }
67 func easyjson21677a1cEncodeBenchmark(out *jwriter.Writer, in SmallPayloadEasyJson) {
68 out.RawByte('{')
69 first := true
70 _ = first
71 {
72 const prefix string = ",\"St\":"
73 if first {
74 first = false
75 out.RawString(prefix[1:])
76 } else {
77 out.RawString(prefix)
78 }
79 out.Int(int(in.St))
80 }
81 {
82 const prefix string = ",\"Sid\":"
83 if first {
84 first = false
85 out.RawString(prefix[1:])
86 } else {
87 out.RawString(prefix)
88 }
89 out.Int(int(in.Sid))
90 }
91 {
92 const prefix string = ",\"Tt\":"
93 if first {
94 first = false
95 out.RawString(prefix[1:])
96 } else {
97 out.RawString(prefix)
98 }
99 out.String(string(in.Tt))
100 }
101 {
102 const prefix string = ",\"Gr\":"
103 if first {
104 first = false
105 out.RawString(prefix[1:])
106 } else {
107 out.RawString(prefix)
108 }
109 out.Int(int(in.Gr))
110 }
111 {
112 const prefix string = ",\"Uuid\":"
113 if first {
114 first = false
115 out.RawString(prefix[1:])
116 } else {
117 out.RawString(prefix)
118 }
119 out.String(string(in.Uuid))
120 }
121 {
122 const prefix string = ",\"Ip\":"
123 if first {
124 first = false
125 out.RawString(prefix[1:])
126 } else {
127 out.RawString(prefix)
128 }
129 out.String(string(in.Ip))
130 }
131 {
132 const prefix string = ",\"Ua\":"
133 if first {
134 first = false
135 out.RawString(prefix[1:])
136 } else {
137 out.RawString(prefix)
138 }
139 out.String(string(in.Ua))
140 }
141 {
142 const prefix string = ",\"Tz\":"
143 if first {
144 first = false
145 out.RawString(prefix[1:])
146 } else {
147 out.RawString(prefix)
148 }
149 out.Int(int(in.Tz))
150 }
151 {
152 const prefix string = ",\"V\":"
153 if first {
154 first = false
155 out.RawString(prefix[1:])
156 } else {
157 out.RawString(prefix)
158 }
159 out.Int(int(in.V))
160 }
161 out.RawByte('}')
162 }
163
164 // MarshalJSON supports json.Marshaler interface
165 func (v SmallPayloadEasyJson) MarshalJSON() ([]byte, error) {
166 w := jwriter.Writer{}
167 easyjson21677a1cEncodeBenchmark(&w, v)
168 return w.Buffer.BuildBytes(), w.Error
169 }
170
171 // MarshalEasyJSON supports easyjson.Marshaler interface
172 func (v SmallPayloadEasyJson) MarshalEasyJSON(w *jwriter.Writer) {
173 easyjson21677a1cEncodeBenchmark(w, v)
174 }
175
176 // UnmarshalJSON supports json.Unmarshaler interface
177 func (v *SmallPayloadEasyJson) UnmarshalJSON(data []byte) error {
178 r := jlexer.Lexer{Data: data}
179 easyjson21677a1cDecodeBenchmark(&r, v)
180 return r.Error()
181 }
182
183 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
184 func (v *SmallPayloadEasyJson) UnmarshalEasyJSON(l *jlexer.Lexer) {
185 easyjson21677a1cDecodeBenchmark(l, v)
186 }