Debian Codegraph @

bulk_update_request_easyjson.go

raw
1 // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
2
3 package elastic
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 easyjson1ed00e60DecodeGopkgInOlivereElasticV5(in *jlexer.Lexer, out *bulkUpdateRequestCommandOp) {
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 "_id":
40 out.Id = string(in.String())
41 case "_index":
42 out.Index = string(in.String())
43 case "_type":
44 out.Type = string(in.String())
45 case "_parent":
46 out.Parent = string(in.String())
47 case "_retry_on_conflict":
48 if in.IsNull() {
49 in.Skip()
50 out.RetryOnConflict = nil
51 } else {
52 if out.RetryOnConflict == nil {
53 out.RetryOnConflict = new(int)
54 }
55 *out.RetryOnConflict = int(in.Int())
56 }
57 case "_routing":
58 out.Routing = string(in.String())
59 case "_version":
60 out.Version = int64(in.Int64())
61 case "_version_type":
62 out.VersionType = string(in.String())
63 default:
64 in.SkipRecursive()
65 }
66 in.WantComma()
67 }
68 in.Delim('}')
69 if isTopLevel {
70 in.Consumed()
71 }
72 }
73 func easyjson1ed00e60EncodeGopkgInOlivereElasticV5(out *jwriter.Writer, in bulkUpdateRequestCommandOp) {
74 out.RawByte('{')
75 first := true
76 _ = first
77 if in.Id != "" {
78 const prefix string = ",\"_id\":"
79 if first {
80 first = false
81 out.RawString(prefix[1:])
82 } else {
83 out.RawString(prefix)
84 }
85 out.String(string(in.Id))
86 }
87 if in.Index != "" {
88 const prefix string = ",\"_index\":"
89 if first {
90 first = false
91 out.RawString(prefix[1:])
92 } else {
93 out.RawString(prefix)
94 }
95 out.String(string(in.Index))
96 }
97 if in.Type != "" {
98 const prefix string = ",\"_type\":"
99 if first {
100 first = false
101 out.RawString(prefix[1:])
102 } else {
103 out.RawString(prefix)
104 }
105 out.String(string(in.Type))
106 }
107 if in.Parent != "" {
108 const prefix string = ",\"_parent\":"
109 if first {
110 first = false
111 out.RawString(prefix[1:])
112 } else {
113 out.RawString(prefix)
114 }
115 out.String(string(in.Parent))
116 }
117 if in.RetryOnConflict != nil {
118 const prefix string = ",\"_retry_on_conflict\":"
119 if first {
120 first = false
121 out.RawString(prefix[1:])
122 } else {
123 out.RawString(prefix)
124 }
125 out.Int(int(*in.RetryOnConflict))
126 }
127 if in.Routing != "" {
128 const prefix string = ",\"_routing\":"
129 if first {
130 first = false
131 out.RawString(prefix[1:])
132 } else {
133 out.RawString(prefix)
134 }
135 out.String(string(in.Routing))
136 }
137 if in.Version != 0 {
138 const prefix string = ",\"_version\":"
139 if first {
140 first = false
141 out.RawString(prefix[1:])
142 } else {
143 out.RawString(prefix)
144 }
145 out.Int64(int64(in.Version))
146 }
147 if in.VersionType != "" {
148 const prefix string = ",\"_version_type\":"
149 if first {
150 first = false
151 out.RawString(prefix[1:])
152 } else {
153 out.RawString(prefix)
154 }
155 out.String(string(in.VersionType))
156 }
157 out.RawByte('}')
158 }
159
160 // MarshalJSON supports json.Marshaler interface
161 func (v bulkUpdateRequestCommandOp) MarshalJSON() ([]byte, error) {
162 w := jwriter.Writer{}
163 easyjson1ed00e60EncodeGopkgInOlivereElasticV5(&w, v)
164 return w.Buffer.BuildBytes(), w.Error
165 }
166
167 // MarshalEasyJSON supports easyjson.Marshaler interface
168 func (v bulkUpdateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
169 easyjson1ed00e60EncodeGopkgInOlivereElasticV5(w, v)
170 }
171
172 // UnmarshalJSON supports json.Unmarshaler interface
173 func (v *bulkUpdateRequestCommandOp) UnmarshalJSON(data []byte) error {
174 r := jlexer.Lexer{Data: data}
175 easyjson1ed00e60DecodeGopkgInOlivereElasticV5(&r, v)
176 return r.Error()
177 }
178
179 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
180 func (v *bulkUpdateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
181 easyjson1ed00e60DecodeGopkgInOlivereElasticV5(l, v)
182 }
183 func easyjson1ed00e60DecodeGopkgInOlivereElasticV51(in *jlexer.Lexer, out *bulkUpdateRequestCommandData) {
184 isTopLevel := in.IsStart()
185 if in.IsNull() {
186 if isTopLevel {
187 in.Consumed()
188 }
189 in.Skip()
190 return
191 }
192 in.Delim('{')
193 for !in.IsDelim('}') {
194 key := in.UnsafeString()
195 in.WantColon()
196 if in.IsNull() {
197 in.Skip()
198 in.WantComma()
199 continue
200 }
201 switch key {
202 case "detect_noop":
203 if in.IsNull() {
204 in.Skip()
205 out.DetectNoop = nil
206 } else {
207 if out.DetectNoop == nil {
208 out.DetectNoop = new(bool)
209 }
210 *out.DetectNoop = bool(in.Bool())
211 }
212 case "doc":
213 if m, ok := out.Doc.(easyjson.Unmarshaler); ok {
214 m.UnmarshalEasyJSON(in)
215 } else if m, ok := out.Doc.(json.Unmarshaler); ok {
216 _ = m.UnmarshalJSON(in.Raw())
217 } else {
218 out.Doc = in.Interface()
219 }
220 case "doc_as_upsert":
221 if in.IsNull() {
222 in.Skip()
223 out.DocAsUpsert = nil
224 } else {
225 if out.DocAsUpsert == nil {
226 out.DocAsUpsert = new(bool)
227 }
228 *out.DocAsUpsert = bool(in.Bool())
229 }
230 case "upsert":
231 if m, ok := out.Upsert.(easyjson.Unmarshaler); ok {
232 m.UnmarshalEasyJSON(in)
233 } else if m, ok := out.Upsert.(json.Unmarshaler); ok {
234 _ = m.UnmarshalJSON(in.Raw())
235 } else {
236 out.Upsert = in.Interface()
237 }
238 case "script":
239 if m, ok := out.Script.(easyjson.Unmarshaler); ok {
240 m.UnmarshalEasyJSON(in)
241 } else if m, ok := out.Script.(json.Unmarshaler); ok {
242 _ = m.UnmarshalJSON(in.Raw())
243 } else {
244 out.Script = in.Interface()
245 }
246 case "scripted_upsert":
247 if in.IsNull() {
248 in.Skip()
249 out.ScriptedUpsert = nil
250 } else {
251 if out.ScriptedUpsert == nil {
252 out.ScriptedUpsert = new(bool)
253 }
254 *out.ScriptedUpsert = bool(in.Bool())
255 }
256 case "_source":
257 if in.IsNull() {
258 in.Skip()
259 out.Source = nil
260 } else {
261 if out.Source == nil {
262 out.Source = new(bool)
263 }
264 *out.Source = bool(in.Bool())
265 }
266 default:
267 in.SkipRecursive()
268 }
269 in.WantComma()
270 }
271 in.Delim('}')
272 if isTopLevel {
273 in.Consumed()
274 }
275 }
276 func easyjson1ed00e60EncodeGopkgInOlivereElasticV51(out *jwriter.Writer, in bulkUpdateRequestCommandData) {
277 out.RawByte('{')
278 first := true
279 _ = first
280 if in.DetectNoop != nil {
281 const prefix string = ",\"detect_noop\":"
282 if first {
283 first = false
284 out.RawString(prefix[1:])
285 } else {
286 out.RawString(prefix)
287 }
288 out.Bool(bool(*in.DetectNoop))
289 }
290 if in.Doc != nil {
291 const prefix string = ",\"doc\":"
292 if first {
293 first = false
294 out.RawString(prefix[1:])
295 } else {
296 out.RawString(prefix)
297 }
298 if m, ok := in.Doc.(easyjson.Marshaler); ok {
299 m.MarshalEasyJSON(out)
300 } else if m, ok := in.Doc.(json.Marshaler); ok {
301 out.Raw(m.MarshalJSON())
302 } else {
303 out.Raw(json.Marshal(in.Doc))
304 }
305 }
306 if in.DocAsUpsert != nil {
307 const prefix string = ",\"doc_as_upsert\":"
308 if first {
309 first = false
310 out.RawString(prefix[1:])
311 } else {
312 out.RawString(prefix)
313 }
314 out.Bool(bool(*in.DocAsUpsert))
315 }
316 if in.Upsert != nil {
317 const prefix string = ",\"upsert\":"
318 if first {
319 first = false
320 out.RawString(prefix[1:])
321 } else {
322 out.RawString(prefix)
323 }
324 if m, ok := in.Upsert.(easyjson.Marshaler); ok {
325 m.MarshalEasyJSON(out)
326 } else if m, ok := in.Upsert.(json.Marshaler); ok {
327 out.Raw(m.MarshalJSON())
328 } else {
329 out.Raw(json.Marshal(in.Upsert))
330 }
331 }
332 if in.Script != nil {
333 const prefix string = ",\"script\":"
334 if first {
335 first = false
336 out.RawString(prefix[1:])
337 } else {
338 out.RawString(prefix)
339 }
340 if m, ok := in.Script.(easyjson.Marshaler); ok {
341 m.MarshalEasyJSON(out)
342 } else if m, ok := in.Script.(json.Marshaler); ok {
343 out.Raw(m.MarshalJSON())
344 } else {
345 out.Raw(json.Marshal(in.Script))
346 }
347 }
348 if in.ScriptedUpsert != nil {
349 const prefix string = ",\"scripted_upsert\":"
350 if first {
351 first = false
352 out.RawString(prefix[1:])
353 } else {
354 out.RawString(prefix)
355 }
356 out.Bool(bool(*in.ScriptedUpsert))
357 }
358 if in.Source != nil {
359 const prefix string = ",\"_source\":"
360 if first {
361 first = false
362 out.RawString(prefix[1:])
363 } else {
364 out.RawString(prefix)
365 }
366 out.Bool(bool(*in.Source))
367 }
368 out.RawByte('}')
369 }
370
371 // MarshalJSON supports json.Marshaler interface
372 func (v bulkUpdateRequestCommandData) MarshalJSON() ([]byte, error) {
373 w := jwriter.Writer{}
374 easyjson1ed00e60EncodeGopkgInOlivereElasticV51(&w, v)
375 return w.Buffer.BuildBytes(), w.Error
376 }
377
378 // MarshalEasyJSON supports easyjson.Marshaler interface
379 func (v bulkUpdateRequestCommandData) MarshalEasyJSON(w *jwriter.Writer) {
380 easyjson1ed00e60EncodeGopkgInOlivereElasticV51(w, v)
381 }
382
383 // UnmarshalJSON supports json.Unmarshaler interface
384 func (v *bulkUpdateRequestCommandData) UnmarshalJSON(data []byte) error {
385 r := jlexer.Lexer{Data: data}
386 easyjson1ed00e60DecodeGopkgInOlivereElasticV51(&r, v)
387 return r.Error()
388 }
389
390 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
391 func (v *bulkUpdateRequestCommandData) UnmarshalEasyJSON(l *jlexer.Lexer) {
392 easyjson1ed00e60DecodeGopkgInOlivereElasticV51(l, v)
393 }
394 func easyjson1ed00e60DecodeGopkgInOlivereElasticV52(in *jlexer.Lexer, out *bulkUpdateRequestCommand) {
395 isTopLevel := in.IsStart()
396 if in.IsNull() {
397 in.Skip()
398 } else {
399 in.Delim('{')
400 if !in.IsDelim('}') {
401 *out = make(bulkUpdateRequestCommand)
402 } else {
403 *out = nil
404 }
405 for !in.IsDelim('}') {
406 key := string(in.String())
407 in.WantColon()
408 var v1 bulkUpdateRequestCommandOp
409 (v1).UnmarshalEasyJSON(in)
410 (*out)[key] = v1
411 in.WantComma()
412 }
413 in.Delim('}')
414 }
415 if isTopLevel {
416 in.Consumed()
417 }
418 }
419 func easyjson1ed00e60EncodeGopkgInOlivereElasticV52(out *jwriter.Writer, in bulkUpdateRequestCommand) {
420 if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
421 out.RawString(`null`)
422 } else {
423 out.RawByte('{')
424 v2First := true
425 for v2Name, v2Value := range in {
426 if v2First {
427 v2First = false
428 } else {
429 out.RawByte(',')
430 }
431 out.String(string(v2Name))
432 out.RawByte(':')
433 (v2Value).MarshalEasyJSON(out)
434 }
435 out.RawByte('}')
436 }
437 }
438
439 // MarshalJSON supports json.Marshaler interface
440 func (v bulkUpdateRequestCommand) MarshalJSON() ([]byte, error) {
441 w := jwriter.Writer{}
442 easyjson1ed00e60EncodeGopkgInOlivereElasticV52(&w, v)
443 return w.Buffer.BuildBytes(), w.Error
444 }
445
446 // MarshalEasyJSON supports easyjson.Marshaler interface
447 func (v bulkUpdateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
448 easyjson1ed00e60EncodeGopkgInOlivereElasticV52(w, v)
449 }
450
451 // UnmarshalJSON supports json.Unmarshaler interface
452 func (v *bulkUpdateRequestCommand) UnmarshalJSON(data []byte) error {
453 r := jlexer.Lexer{Data: data}
454 easyjson1ed00e60DecodeGopkgInOlivereElasticV52(&r, v)
455 return r.Error()
456 }
457
458 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
459 func (v *bulkUpdateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
460 easyjson1ed00e60DecodeGopkgInOlivereElasticV52(l, v)
461 }