Debian Codegraph @

benchmark/data_ffjson.go

raw
1 // +build use_ffjson
2
3 // DO NOT EDIT!
4 // Code generated by ffjson <https://github.com/pquerna/ffjson>
5 // source: .root/src/github.com/mailru/easyjson/benchmark/data.go
6 // DO NOT EDIT!
7
8 package benchmark
9
10 import (
11 "bytes"
12 "errors"
13 "fmt"
14 fflib "github.com/pquerna/ffjson/fflib/v1"
15 )
16
17 // MarshalJSON marshal bytes to json - template
18 func (j *Entities) MarshalJSON() ([]byte, error) {
19 var buf fflib.Buffer
20 if j == nil {
21 buf.WriteString("null")
22 return buf.Bytes(), nil
23 }
24 err := j.MarshalJSONBuf(&buf)
25 if err != nil {
26 return nil, err
27 }
28 return buf.Bytes(), nil
29 }
30
31 // MarshalJSONBuf marshal buff to json - template
32 func (j *Entities) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
33 if j == nil {
34 buf.WriteString("null")
35 return nil
36 }
37 var err error
38 var obj []byte
39 _ = obj
40 _ = err
41 buf.WriteString(`{"hashtags":`)
42 if j.Hashtags != nil {
43 buf.WriteString(`[`)
44 for i, v := range j.Hashtags {
45 if i != 0 {
46 buf.WriteString(`,`)
47 }
48
49 {
50
51 err = v.MarshalJSONBuf(buf)
52 if err != nil {
53 return err
54 }
55
56 }
57 }
58 buf.WriteString(`]`)
59 } else {
60 buf.WriteString(`null`)
61 }
62 buf.WriteString(`,"urls":`)
63 if j.Urls != nil {
64 buf.WriteString(`[`)
65 for i, v := range j.Urls {
66 if i != 0 {
67 buf.WriteString(`,`)
68 }
69 if v != nil {
70 fflib.WriteJsonString(buf, string(*v))
71 } else {
72 buf.WriteString(`null`)
73 }
74 }
75 buf.WriteString(`]`)
76 } else {
77 buf.WriteString(`null`)
78 }
79 buf.WriteString(`,"user_mentions":`)
80 if j.UserMentions != nil {
81 buf.WriteString(`[`)
82 for i, v := range j.UserMentions {
83 if i != 0 {
84 buf.WriteString(`,`)
85 }
86 if v != nil {
87 fflib.WriteJsonString(buf, string(*v))
88 } else {
89 buf.WriteString(`null`)
90 }
91 }
92 buf.WriteString(`]`)
93 } else {
94 buf.WriteString(`null`)
95 }
96 buf.WriteByte('}')
97 return nil
98 }
99
100 const (
101 ffjtEntitiesbase = iota
102 ffjtEntitiesnosuchkey
103
104 ffjtEntitiesHashtags
105
106 ffjtEntitiesUrls
107
108 ffjtEntitiesUserMentions
109 )
110
111 var ffjKeyEntitiesHashtags = []byte("hashtags")
112
113 var ffjKeyEntitiesUrls = []byte("urls")
114
115 var ffjKeyEntitiesUserMentions = []byte("user_mentions")
116
117 // UnmarshalJSON umarshall json - template of ffjson
118 func (j *Entities) UnmarshalJSON(input []byte) error {
119 fs := fflib.NewFFLexer(input)
120 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
121 }
122
123 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
124 func (j *Entities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
125 var err error
126 currentKey := ffjtEntitiesbase
127 _ = currentKey
128 tok := fflib.FFTok_init
129 wantedTok := fflib.FFTok_init
130
131 mainparse:
132 for {
133 tok = fs.Scan()
134 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
135 if tok == fflib.FFTok_error {
136 goto tokerror
137 }
138
139 switch state {
140
141 case fflib.FFParse_map_start:
142 if tok != fflib.FFTok_left_bracket {
143 wantedTok = fflib.FFTok_left_bracket
144 goto wrongtokenerror
145 }
146 state = fflib.FFParse_want_key
147 continue
148
149 case fflib.FFParse_after_value:
150 if tok == fflib.FFTok_comma {
151 state = fflib.FFParse_want_key
152 } else if tok == fflib.FFTok_right_bracket {
153 goto done
154 } else {
155 wantedTok = fflib.FFTok_comma
156 goto wrongtokenerror
157 }
158
159 case fflib.FFParse_want_key:
160 // json {} ended. goto exit. woo.
161 if tok == fflib.FFTok_right_bracket {
162 goto done
163 }
164 if tok != fflib.FFTok_string {
165 wantedTok = fflib.FFTok_string
166 goto wrongtokenerror
167 }
168
169 kn := fs.Output.Bytes()
170 if len(kn) <= 0 {
171 // "" case. hrm.
172 currentKey = ffjtEntitiesnosuchkey
173 state = fflib.FFParse_want_colon
174 goto mainparse
175 } else {
176 switch kn[0] {
177
178 case 'h':
179
180 if bytes.Equal(ffjKeyEntitiesHashtags, kn) {
181 currentKey = ffjtEntitiesHashtags
182 state = fflib.FFParse_want_colon
183 goto mainparse
184 }
185
186 case 'u':
187
188 if bytes.Equal(ffjKeyEntitiesUrls, kn) {
189 currentKey = ffjtEntitiesUrls
190 state = fflib.FFParse_want_colon
191 goto mainparse
192
193 } else if bytes.Equal(ffjKeyEntitiesUserMentions, kn) {
194 currentKey = ffjtEntitiesUserMentions
195 state = fflib.FFParse_want_colon
196 goto mainparse
197 }
198
199 }
200
201 if fflib.EqualFoldRight(ffjKeyEntitiesUserMentions, kn) {
202 currentKey = ffjtEntitiesUserMentions
203 state = fflib.FFParse_want_colon
204 goto mainparse
205 }
206
207 if fflib.EqualFoldRight(ffjKeyEntitiesUrls, kn) {
208 currentKey = ffjtEntitiesUrls
209 state = fflib.FFParse_want_colon
210 goto mainparse
211 }
212
213 if fflib.EqualFoldRight(ffjKeyEntitiesHashtags, kn) {
214 currentKey = ffjtEntitiesHashtags
215 state = fflib.FFParse_want_colon
216 goto mainparse
217 }
218
219 currentKey = ffjtEntitiesnosuchkey
220 state = fflib.FFParse_want_colon
221 goto mainparse
222 }
223
224 case fflib.FFParse_want_colon:
225 if tok != fflib.FFTok_colon {
226 wantedTok = fflib.FFTok_colon
227 goto wrongtokenerror
228 }
229 state = fflib.FFParse_want_value
230 continue
231 case fflib.FFParse_want_value:
232
233 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
234 switch currentKey {
235
236 case ffjtEntitiesHashtags:
237 goto handle_Hashtags
238
239 case ffjtEntitiesUrls:
240 goto handle_Urls
241
242 case ffjtEntitiesUserMentions:
243 goto handle_UserMentions
244
245 case ffjtEntitiesnosuchkey:
246 err = fs.SkipField(tok)
247 if err != nil {
248 return fs.WrapErr(err)
249 }
250 state = fflib.FFParse_after_value
251 goto mainparse
252 }
253 } else {
254 goto wantedvalue
255 }
256 }
257 }
258
259 handle_Hashtags:
260
261 /* handler: j.Hashtags type=[]benchmark.Hashtag kind=slice quoted=false*/
262
263 {
264
265 {
266 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
267 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
268 }
269 }
270
271 if tok == fflib.FFTok_null {
272 j.Hashtags = nil
273 } else {
274
275 j.Hashtags = []Hashtag{}
276
277 wantVal := true
278
279 for {
280
281 var tmpJHashtags Hashtag
282
283 tok = fs.Scan()
284 if tok == fflib.FFTok_error {
285 goto tokerror
286 }
287 if tok == fflib.FFTok_right_brace {
288 break
289 }
290
291 if tok == fflib.FFTok_comma {
292 if wantVal == true {
293 // TODO(pquerna): this isn't an ideal error message, this handles
294 // things like [,,,] as an array value.
295 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
296 }
297 continue
298 } else {
299 wantVal = true
300 }
301
302 /* handler: tmpJHashtags type=benchmark.Hashtag kind=struct quoted=false*/
303
304 {
305 if tok == fflib.FFTok_null {
306
307 } else {
308
309 err = tmpJHashtags.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
310 if err != nil {
311 return err
312 }
313 }
314 state = fflib.FFParse_after_value
315 }
316
317 j.Hashtags = append(j.Hashtags, tmpJHashtags)
318
319 wantVal = false
320 }
321 }
322 }
323
324 state = fflib.FFParse_after_value
325 goto mainparse
326
327 handle_Urls:
328
329 /* handler: j.Urls type=[]*string kind=slice quoted=false*/
330
331 {
332
333 {
334 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
335 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
336 }
337 }
338
339 if tok == fflib.FFTok_null {
340 j.Urls = nil
341 } else {
342
343 j.Urls = []*string{}
344
345 wantVal := true
346
347 for {
348
349 var tmpJUrls *string
350
351 tok = fs.Scan()
352 if tok == fflib.FFTok_error {
353 goto tokerror
354 }
355 if tok == fflib.FFTok_right_brace {
356 break
357 }
358
359 if tok == fflib.FFTok_comma {
360 if wantVal == true {
361 // TODO(pquerna): this isn't an ideal error message, this handles
362 // things like [,,,] as an array value.
363 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
364 }
365 continue
366 } else {
367 wantVal = true
368 }
369
370 /* handler: tmpJUrls type=*string kind=ptr quoted=false*/
371
372 {
373
374 if tok == fflib.FFTok_null {
375 tmpJUrls = nil
376 } else {
377 if tmpJUrls == nil {
378 tmpJUrls = new(string)
379 }
380
381 /* handler: tmpJUrls type=string kind=string quoted=false*/
382
383 {
384
385 {
386 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
387 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
388 }
389 }
390
391 if tok == fflib.FFTok_null {
392
393 tmpJUrls = nil
394
395 } else {
396
397 var tval string
398 outBuf := fs.Output.Bytes()
399
400 tval = string(string(outBuf))
401 tmpJUrls = &tval
402
403 }
404 }
405
406 }
407 }
408
409 j.Urls = append(j.Urls, tmpJUrls)
410
411 wantVal = false
412 }
413 }
414 }
415
416 state = fflib.FFParse_after_value
417 goto mainparse
418
419 handle_UserMentions:
420
421 /* handler: j.UserMentions type=[]*string kind=slice quoted=false*/
422
423 {
424
425 {
426 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
427 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
428 }
429 }
430
431 if tok == fflib.FFTok_null {
432 j.UserMentions = nil
433 } else {
434
435 j.UserMentions = []*string{}
436
437 wantVal := true
438
439 for {
440
441 var tmpJUserMentions *string
442
443 tok = fs.Scan()
444 if tok == fflib.FFTok_error {
445 goto tokerror
446 }
447 if tok == fflib.FFTok_right_brace {
448 break
449 }
450
451 if tok == fflib.FFTok_comma {
452 if wantVal == true {
453 // TODO(pquerna): this isn't an ideal error message, this handles
454 // things like [,,,] as an array value.
455 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
456 }
457 continue
458 } else {
459 wantVal = true
460 }
461
462 /* handler: tmpJUserMentions type=*string kind=ptr quoted=false*/
463
464 {
465
466 if tok == fflib.FFTok_null {
467 tmpJUserMentions = nil
468 } else {
469 if tmpJUserMentions == nil {
470 tmpJUserMentions = new(string)
471 }
472
473 /* handler: tmpJUserMentions type=string kind=string quoted=false*/
474
475 {
476
477 {
478 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
479 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
480 }
481 }
482
483 if tok == fflib.FFTok_null {
484
485 tmpJUserMentions = nil
486
487 } else {
488
489 var tval string
490 outBuf := fs.Output.Bytes()
491
492 tval = string(string(outBuf))
493 tmpJUserMentions = &tval
494
495 }
496 }
497
498 }
499 }
500
501 j.UserMentions = append(j.UserMentions, tmpJUserMentions)
502
503 wantVal = false
504 }
505 }
506 }
507
508 state = fflib.FFParse_after_value
509 goto mainparse
510
511 wantedvalue:
512 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
513 wrongtokenerror:
514 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
515 tokerror:
516 if fs.BigError != nil {
517 return fs.WrapErr(fs.BigError)
518 }
519 err = fs.Error.ToError()
520 if err != nil {
521 return fs.WrapErr(err)
522 }
523 panic("ffjson-generated: unreachable, please report bug.")
524 done:
525
526 return nil
527 }
528
529 // MarshalJSON marshal bytes to json - template
530 func (j *Hashtag) MarshalJSON() ([]byte, error) {
531 var buf fflib.Buffer
532 if j == nil {
533 buf.WriteString("null")
534 return buf.Bytes(), nil
535 }
536 err := j.MarshalJSONBuf(&buf)
537 if err != nil {
538 return nil, err
539 }
540 return buf.Bytes(), nil
541 }
542
543 // MarshalJSONBuf marshal buff to json - template
544 func (j *Hashtag) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
545 if j == nil {
546 buf.WriteString("null")
547 return nil
548 }
549 var err error
550 var obj []byte
551 _ = obj
552 _ = err
553 buf.WriteString(`{"indices":`)
554 if j.Indices != nil {
555 buf.WriteString(`[`)
556 for i, v := range j.Indices {
557 if i != 0 {
558 buf.WriteString(`,`)
559 }
560 fflib.FormatBits2(buf, uint64(v), 10, v < 0)
561 }
562 buf.WriteString(`]`)
563 } else {
564 buf.WriteString(`null`)
565 }
566 buf.WriteString(`,"text":`)
567 fflib.WriteJsonString(buf, string(j.Text))
568 buf.WriteByte('}')
569 return nil
570 }
571
572 const (
573 ffjtHashtagbase = iota
574 ffjtHashtagnosuchkey
575
576 ffjtHashtagIndices
577
578 ffjtHashtagText
579 )
580
581 var ffjKeyHashtagIndices = []byte("indices")
582
583 var ffjKeyHashtagText = []byte("text")
584
585 // UnmarshalJSON umarshall json - template of ffjson
586 func (j *Hashtag) UnmarshalJSON(input []byte) error {
587 fs := fflib.NewFFLexer(input)
588 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
589 }
590
591 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
592 func (j *Hashtag) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
593 var err error
594 currentKey := ffjtHashtagbase
595 _ = currentKey
596 tok := fflib.FFTok_init
597 wantedTok := fflib.FFTok_init
598
599 mainparse:
600 for {
601 tok = fs.Scan()
602 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
603 if tok == fflib.FFTok_error {
604 goto tokerror
605 }
606
607 switch state {
608
609 case fflib.FFParse_map_start:
610 if tok != fflib.FFTok_left_bracket {
611 wantedTok = fflib.FFTok_left_bracket
612 goto wrongtokenerror
613 }
614 state = fflib.FFParse_want_key
615 continue
616
617 case fflib.FFParse_after_value:
618 if tok == fflib.FFTok_comma {
619 state = fflib.FFParse_want_key
620 } else if tok == fflib.FFTok_right_bracket {
621 goto done
622 } else {
623 wantedTok = fflib.FFTok_comma
624 goto wrongtokenerror
625 }
626
627 case fflib.FFParse_want_key:
628 // json {} ended. goto exit. woo.
629 if tok == fflib.FFTok_right_bracket {
630 goto done
631 }
632 if tok != fflib.FFTok_string {
633 wantedTok = fflib.FFTok_string
634 goto wrongtokenerror
635 }
636
637 kn := fs.Output.Bytes()
638 if len(kn) <= 0 {
639 // "" case. hrm.
640 currentKey = ffjtHashtagnosuchkey
641 state = fflib.FFParse_want_colon
642 goto mainparse
643 } else {
644 switch kn[0] {
645
646 case 'i':
647
648 if bytes.Equal(ffjKeyHashtagIndices, kn) {
649 currentKey = ffjtHashtagIndices
650 state = fflib.FFParse_want_colon
651 goto mainparse
652 }
653
654 case 't':
655
656 if bytes.Equal(ffjKeyHashtagText, kn) {
657 currentKey = ffjtHashtagText
658 state = fflib.FFParse_want_colon
659 goto mainparse
660 }
661
662 }
663
664 if fflib.SimpleLetterEqualFold(ffjKeyHashtagText, kn) {
665 currentKey = ffjtHashtagText
666 state = fflib.FFParse_want_colon
667 goto mainparse
668 }
669
670 if fflib.EqualFoldRight(ffjKeyHashtagIndices, kn) {
671 currentKey = ffjtHashtagIndices
672 state = fflib.FFParse_want_colon
673 goto mainparse
674 }
675
676 currentKey = ffjtHashtagnosuchkey
677 state = fflib.FFParse_want_colon
678 goto mainparse
679 }
680
681 case fflib.FFParse_want_colon:
682 if tok != fflib.FFTok_colon {
683 wantedTok = fflib.FFTok_colon
684 goto wrongtokenerror
685 }
686 state = fflib.FFParse_want_value
687 continue
688 case fflib.FFParse_want_value:
689
690 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
691 switch currentKey {
692
693 case ffjtHashtagIndices:
694 goto handle_Indices
695
696 case ffjtHashtagText:
697 goto handle_Text
698
699 case ffjtHashtagnosuchkey:
700 err = fs.SkipField(tok)
701 if err != nil {
702 return fs.WrapErr(err)
703 }
704 state = fflib.FFParse_after_value
705 goto mainparse
706 }
707 } else {
708 goto wantedvalue
709 }
710 }
711 }
712
713 handle_Indices:
714
715 /* handler: j.Indices type=[]int kind=slice quoted=false*/
716
717 {
718
719 {
720 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
721 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
722 }
723 }
724
725 if tok == fflib.FFTok_null {
726 j.Indices = nil
727 } else {
728
729 j.Indices = []int{}
730
731 wantVal := true
732
733 for {
734
735 var tmpJIndices int
736
737 tok = fs.Scan()
738 if tok == fflib.FFTok_error {
739 goto tokerror
740 }
741 if tok == fflib.FFTok_right_brace {
742 break
743 }
744
745 if tok == fflib.FFTok_comma {
746 if wantVal == true {
747 // TODO(pquerna): this isn't an ideal error message, this handles
748 // things like [,,,] as an array value.
749 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
750 }
751 continue
752 } else {
753 wantVal = true
754 }
755
756 /* handler: tmpJIndices type=int kind=int quoted=false*/
757
758 {
759 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
760 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
761 }
762 }
763
764 {
765
766 if tok == fflib.FFTok_null {
767
768 } else {
769
770 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
771
772 if err != nil {
773 return fs.WrapErr(err)
774 }
775
776 tmpJIndices = int(tval)
777
778 }
779 }
780
781 j.Indices = append(j.Indices, tmpJIndices)
782
783 wantVal = false
784 }
785 }
786 }
787
788 state = fflib.FFParse_after_value
789 goto mainparse
790
791 handle_Text:
792
793 /* handler: j.Text type=string kind=string quoted=false*/
794
795 {
796
797 {
798 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
799 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
800 }
801 }
802
803 if tok == fflib.FFTok_null {
804
805 } else {
806
807 outBuf := fs.Output.Bytes()
808
809 j.Text = string(string(outBuf))
810
811 }
812 }
813
814 state = fflib.FFParse_after_value
815 goto mainparse
816
817 wantedvalue:
818 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
819 wrongtokenerror:
820 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
821 tokerror:
822 if fs.BigError != nil {
823 return fs.WrapErr(fs.BigError)
824 }
825 err = fs.Error.ToError()
826 if err != nil {
827 return fs.WrapErr(err)
828 }
829 panic("ffjson-generated: unreachable, please report bug.")
830 done:
831
832 return nil
833 }
834
835 // MarshalJSON marshal bytes to json - template
836 func (j *LargeStruct) MarshalJSON() ([]byte, error) {
837 var buf fflib.Buffer
838 if j == nil {
839 buf.WriteString("null")
840 return buf.Bytes(), nil
841 }
842 err := j.MarshalJSONBuf(&buf)
843 if err != nil {
844 return nil, err
845 }
846 return buf.Bytes(), nil
847 }
848
849 // MarshalJSONBuf marshal buff to json - template
850 func (j *LargeStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
851 if j == nil {
852 buf.WriteString("null")
853 return nil
854 }
855 var err error
856 var obj []byte
857 _ = obj
858 _ = err
859 buf.WriteString(`{"search_metadata":`)
860
861 {
862
863 err = j.SearchMetadata.MarshalJSONBuf(buf)
864 if err != nil {
865 return err
866 }
867
868 }
869 buf.WriteString(`,"statuses":`)
870 if j.Statuses != nil {
871 buf.WriteString(`[`)
872 for i, v := range j.Statuses {
873 if i != 0 {
874 buf.WriteString(`,`)
875 }
876
877 {
878
879 err = v.MarshalJSONBuf(buf)
880 if err != nil {
881 return err
882 }
883
884 }
885 }
886 buf.WriteString(`]`)
887 } else {
888 buf.WriteString(`null`)
889 }
890 buf.WriteByte('}')
891 return nil
892 }
893
894 const (
895 ffjtLargeStructbase = iota
896 ffjtLargeStructnosuchkey
897
898 ffjtLargeStructSearchMetadata
899
900 ffjtLargeStructStatuses
901 )
902
903 var ffjKeyLargeStructSearchMetadata = []byte("search_metadata")
904
905 var ffjKeyLargeStructStatuses = []byte("statuses")
906
907 // UnmarshalJSON umarshall json - template of ffjson
908 func (j *LargeStruct) UnmarshalJSON(input []byte) error {
909 fs := fflib.NewFFLexer(input)
910 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
911 }
912
913 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
914 func (j *LargeStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
915 var err error
916 currentKey := ffjtLargeStructbase
917 _ = currentKey
918 tok := fflib.FFTok_init
919 wantedTok := fflib.FFTok_init
920
921 mainparse:
922 for {
923 tok = fs.Scan()
924 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
925 if tok == fflib.FFTok_error {
926 goto tokerror
927 }
928
929 switch state {
930
931 case fflib.FFParse_map_start:
932 if tok != fflib.FFTok_left_bracket {
933 wantedTok = fflib.FFTok_left_bracket
934 goto wrongtokenerror
935 }
936 state = fflib.FFParse_want_key
937 continue
938
939 case fflib.FFParse_after_value:
940 if tok == fflib.FFTok_comma {
941 state = fflib.FFParse_want_key
942 } else if tok == fflib.FFTok_right_bracket {
943 goto done
944 } else {
945 wantedTok = fflib.FFTok_comma
946 goto wrongtokenerror
947 }
948
949 case fflib.FFParse_want_key:
950 // json {} ended. goto exit. woo.
951 if tok == fflib.FFTok_right_bracket {
952 goto done
953 }
954 if tok != fflib.FFTok_string {
955 wantedTok = fflib.FFTok_string
956 goto wrongtokenerror
957 }
958
959 kn := fs.Output.Bytes()
960 if len(kn) <= 0 {
961 // "" case. hrm.
962 currentKey = ffjtLargeStructnosuchkey
963 state = fflib.FFParse_want_colon
964 goto mainparse
965 } else {
966 switch kn[0] {
967
968 case 's':
969
970 if bytes.Equal(ffjKeyLargeStructSearchMetadata, kn) {
971 currentKey = ffjtLargeStructSearchMetadata
972 state = fflib.FFParse_want_colon
973 goto mainparse
974
975 } else if bytes.Equal(ffjKeyLargeStructStatuses, kn) {
976 currentKey = ffjtLargeStructStatuses
977 state = fflib.FFParse_want_colon
978 goto mainparse
979 }
980
981 }
982
983 if fflib.EqualFoldRight(ffjKeyLargeStructStatuses, kn) {
984 currentKey = ffjtLargeStructStatuses
985 state = fflib.FFParse_want_colon
986 goto mainparse
987 }
988
989 if fflib.EqualFoldRight(ffjKeyLargeStructSearchMetadata, kn) {
990 currentKey = ffjtLargeStructSearchMetadata
991 state = fflib.FFParse_want_colon
992 goto mainparse
993 }
994
995 currentKey = ffjtLargeStructnosuchkey
996 state = fflib.FFParse_want_colon
997 goto mainparse
998 }
999
1000 case fflib.FFParse_want_colon:
1001 if tok != fflib.FFTok_colon {
1002 wantedTok = fflib.FFTok_colon
1003 goto wrongtokenerror
1004 }
1005 state = fflib.FFParse_want_value
1006 continue
1007 case fflib.FFParse_want_value:
1008
1009 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
1010 switch currentKey {
1011
1012 case ffjtLargeStructSearchMetadata:
1013 goto handle_SearchMetadata
1014
1015 case ffjtLargeStructStatuses:
1016 goto handle_Statuses
1017
1018 case ffjtLargeStructnosuchkey:
1019 err = fs.SkipField(tok)
1020 if err != nil {
1021 return fs.WrapErr(err)
1022 }
1023 state = fflib.FFParse_after_value
1024 goto mainparse
1025 }
1026 } else {
1027 goto wantedvalue
1028 }
1029 }
1030 }
1031
1032 handle_SearchMetadata:
1033
1034 /* handler: j.SearchMetadata type=benchmark.SearchMetadata kind=struct quoted=false*/
1035
1036 {
1037 if tok == fflib.FFTok_null {
1038
1039 } else {
1040
1041 err = j.SearchMetadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
1042 if err != nil {
1043 return err
1044 }
1045 }
1046 state = fflib.FFParse_after_value
1047 }
1048
1049 state = fflib.FFParse_after_value
1050 goto mainparse
1051
1052 handle_Statuses:
1053
1054 /* handler: j.Statuses type=[]benchmark.Status kind=slice quoted=false*/
1055
1056 {
1057
1058 {
1059 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
1060 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
1061 }
1062 }
1063
1064 if tok == fflib.FFTok_null {
1065 j.Statuses = nil
1066 } else {
1067
1068 j.Statuses = []Status{}
1069
1070 wantVal := true
1071
1072 for {
1073
1074 var tmpJStatuses Status
1075
1076 tok = fs.Scan()
1077 if tok == fflib.FFTok_error {
1078 goto tokerror
1079 }
1080 if tok == fflib.FFTok_right_brace {
1081 break
1082 }
1083
1084 if tok == fflib.FFTok_comma {
1085 if wantVal == true {
1086 // TODO(pquerna): this isn't an ideal error message, this handles
1087 // things like [,,,] as an array value.
1088 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
1089 }
1090 continue
1091 } else {
1092 wantVal = true
1093 }
1094
1095 /* handler: tmpJStatuses type=benchmark.Status kind=struct quoted=false*/
1096
1097 {
1098 if tok == fflib.FFTok_null {
1099
1100 } else {
1101
1102 err = tmpJStatuses.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
1103 if err != nil {
1104 return err
1105 }
1106 }
1107 state = fflib.FFParse_after_value
1108 }
1109
1110 j.Statuses = append(j.Statuses, tmpJStatuses)
1111
1112 wantVal = false
1113 }
1114 }
1115 }
1116
1117 state = fflib.FFParse_after_value
1118 goto mainparse
1119
1120 wantedvalue:
1121 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
1122 wrongtokenerror:
1123 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
1124 tokerror:
1125 if fs.BigError != nil {
1126 return fs.WrapErr(fs.BigError)
1127 }
1128 err = fs.Error.ToError()
1129 if err != nil {
1130 return fs.WrapErr(err)
1131 }
1132 panic("ffjson-generated: unreachable, please report bug.")
1133 done:
1134
1135 return nil
1136 }
1137
1138 // MarshalJSON marshal bytes to json - template
1139 func (j *SearchMetadata) MarshalJSON() ([]byte, error) {
1140 var buf fflib.Buffer
1141 if j == nil {
1142 buf.WriteString("null")
1143 return buf.Bytes(), nil
1144 }
1145 err := j.MarshalJSONBuf(&buf)
1146 if err != nil {
1147 return nil, err
1148 }
1149 return buf.Bytes(), nil
1150 }
1151
1152 // MarshalJSONBuf marshal buff to json - template
1153 func (j *SearchMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
1154 if j == nil {
1155 buf.WriteString("null")
1156 return nil
1157 }
1158 var err error
1159 var obj []byte
1160 _ = obj
1161 _ = err
1162 buf.WriteString(`{"completed_in":`)
1163 fflib.AppendFloat(buf, float64(j.CompletedIn), 'g', -1, 64)
1164 buf.WriteString(`,"count":`)
1165 fflib.FormatBits2(buf, uint64(j.Count), 10, j.Count < 0)
1166 buf.WriteString(`,"max_id":`)
1167 fflib.FormatBits2(buf, uint64(j.MaxID), 10, j.MaxID < 0)
1168 buf.WriteString(`,"max_id_str":`)
1169 fflib.WriteJsonString(buf, string(j.MaxIDStr))
1170 buf.WriteString(`,"next_results":`)
1171 fflib.WriteJsonString(buf, string(j.NextResults))
1172 buf.WriteString(`,"query":`)
1173 fflib.WriteJsonString(buf, string(j.Query))
1174 buf.WriteString(`,"refresh_url":`)
1175 fflib.WriteJsonString(buf, string(j.RefreshURL))
1176 buf.WriteString(`,"since_id":`)
1177 fflib.FormatBits2(buf, uint64(j.SinceID), 10, j.SinceID < 0)
1178 buf.WriteString(`,"since_id_str":`)
1179 fflib.WriteJsonString(buf, string(j.SinceIDStr))
1180 buf.WriteByte('}')
1181 return nil
1182 }
1183
1184 const (
1185 ffjtSearchMetadatabase = iota
1186 ffjtSearchMetadatanosuchkey
1187
1188 ffjtSearchMetadataCompletedIn
1189
1190 ffjtSearchMetadataCount
1191
1192 ffjtSearchMetadataMaxID
1193
1194 ffjtSearchMetadataMaxIDStr
1195
1196 ffjtSearchMetadataNextResults
1197
1198 ffjtSearchMetadataQuery
1199
1200 ffjtSearchMetadataRefreshURL
1201
1202 ffjtSearchMetadataSinceID
1203
1204 ffjtSearchMetadataSinceIDStr
1205 )
1206
1207 var ffjKeySearchMetadataCompletedIn = []byte("completed_in")
1208
1209 var ffjKeySearchMetadataCount = []byte("count")
1210
1211 var ffjKeySearchMetadataMaxID = []byte("max_id")
1212
1213 var ffjKeySearchMetadataMaxIDStr = []byte("max_id_str")
1214
1215 var ffjKeySearchMetadataNextResults = []byte("next_results")
1216
1217 var ffjKeySearchMetadataQuery = []byte("query")
1218
1219 var ffjKeySearchMetadataRefreshURL = []byte("refresh_url")
1220
1221 var ffjKeySearchMetadataSinceID = []byte("since_id")
1222
1223 var ffjKeySearchMetadataSinceIDStr = []byte("since_id_str")
1224
1225 // UnmarshalJSON umarshall json - template of ffjson
1226 func (j *SearchMetadata) UnmarshalJSON(input []byte) error {
1227 fs := fflib.NewFFLexer(input)
1228 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
1229 }
1230
1231 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
1232 func (j *SearchMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
1233 var err error
1234 currentKey := ffjtSearchMetadatabase
1235 _ = currentKey
1236 tok := fflib.FFTok_init
1237 wantedTok := fflib.FFTok_init
1238
1239 mainparse:
1240 for {
1241 tok = fs.Scan()
1242 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
1243 if tok == fflib.FFTok_error {
1244 goto tokerror
1245 }
1246
1247 switch state {
1248
1249 case fflib.FFParse_map_start:
1250 if tok != fflib.FFTok_left_bracket {
1251 wantedTok = fflib.FFTok_left_bracket
1252 goto wrongtokenerror
1253 }
1254 state = fflib.FFParse_want_key
1255 continue
1256
1257 case fflib.FFParse_after_value:
1258 if tok == fflib.FFTok_comma {
1259 state = fflib.FFParse_want_key
1260 } else if tok == fflib.FFTok_right_bracket {
1261 goto done
1262 } else {
1263 wantedTok = fflib.FFTok_comma
1264 goto wrongtokenerror
1265 }
1266
1267 case fflib.FFParse_want_key:
1268 // json {} ended. goto exit. woo.
1269 if tok == fflib.FFTok_right_bracket {
1270 goto done
1271 }
1272 if tok != fflib.FFTok_string {
1273 wantedTok = fflib.FFTok_string
1274 goto wrongtokenerror
1275 }
1276
1277 kn := fs.Output.Bytes()
1278 if len(kn) <= 0 {
1279 // "" case. hrm.
1280 currentKey = ffjtSearchMetadatanosuchkey
1281 state = fflib.FFParse_want_colon
1282 goto mainparse
1283 } else {
1284 switch kn[0] {
1285
1286 case 'c':
1287
1288 if bytes.Equal(ffjKeySearchMetadataCompletedIn, kn) {
1289 currentKey = ffjtSearchMetadataCompletedIn
1290 state = fflib.FFParse_want_colon
1291 goto mainparse
1292
1293 } else if bytes.Equal(ffjKeySearchMetadataCount, kn) {
1294 currentKey = ffjtSearchMetadataCount
1295 state = fflib.FFParse_want_colon
1296 goto mainparse
1297 }
1298
1299 case 'm':
1300
1301 if bytes.Equal(ffjKeySearchMetadataMaxID, kn) {
1302 currentKey = ffjtSearchMetadataMaxID
1303 state = fflib.FFParse_want_colon
1304 goto mainparse
1305
1306 } else if bytes.Equal(ffjKeySearchMetadataMaxIDStr, kn) {
1307 currentKey = ffjtSearchMetadataMaxIDStr
1308 state = fflib.FFParse_want_colon
1309 goto mainparse
1310 }
1311
1312 case 'n':
1313
1314 if bytes.Equal(ffjKeySearchMetadataNextResults, kn) {
1315 currentKey = ffjtSearchMetadataNextResults
1316 state = fflib.FFParse_want_colon
1317 goto mainparse
1318 }
1319
1320 case 'q':
1321
1322 if bytes.Equal(ffjKeySearchMetadataQuery, kn) {
1323 currentKey = ffjtSearchMetadataQuery
1324 state = fflib.FFParse_want_colon
1325 goto mainparse
1326 }
1327
1328 case 'r':
1329
1330 if bytes.Equal(ffjKeySearchMetadataRefreshURL, kn) {
1331 currentKey = ffjtSearchMetadataRefreshURL
1332 state = fflib.FFParse_want_colon
1333 goto mainparse
1334 }
1335
1336 case 's':
1337
1338 if bytes.Equal(ffjKeySearchMetadataSinceID, kn) {
1339 currentKey = ffjtSearchMetadataSinceID
1340 state = fflib.FFParse_want_colon
1341 goto mainparse
1342
1343 } else if bytes.Equal(ffjKeySearchMetadataSinceIDStr, kn) {
1344 currentKey = ffjtSearchMetadataSinceIDStr
1345 state = fflib.FFParse_want_colon
1346 goto mainparse
1347 }
1348
1349 }
1350
1351 if fflib.EqualFoldRight(ffjKeySearchMetadataSinceIDStr, kn) {
1352 currentKey = ffjtSearchMetadataSinceIDStr
1353 state = fflib.FFParse_want_colon
1354 goto mainparse
1355 }
1356
1357 if fflib.EqualFoldRight(ffjKeySearchMetadataSinceID, kn) {
1358 currentKey = ffjtSearchMetadataSinceID
1359 state = fflib.FFParse_want_colon
1360 goto mainparse
1361 }
1362
1363 if fflib.EqualFoldRight(ffjKeySearchMetadataRefreshURL, kn) {
1364 currentKey = ffjtSearchMetadataRefreshURL
1365 state = fflib.FFParse_want_colon
1366 goto mainparse
1367 }
1368
1369 if fflib.SimpleLetterEqualFold(ffjKeySearchMetadataQuery, kn) {
1370 currentKey = ffjtSearchMetadataQuery
1371 state = fflib.FFParse_want_colon
1372 goto mainparse
1373 }
1374
1375 if fflib.EqualFoldRight(ffjKeySearchMetadataNextResults, kn) {
1376 currentKey = ffjtSearchMetadataNextResults
1377 state = fflib.FFParse_want_colon
1378 goto mainparse
1379 }
1380
1381 if fflib.EqualFoldRight(ffjKeySearchMetadataMaxIDStr, kn) {
1382 currentKey = ffjtSearchMetadataMaxIDStr
1383 state = fflib.FFParse_want_colon
1384 goto mainparse
1385 }
1386
1387 if fflib.AsciiEqualFold(ffjKeySearchMetadataMaxID, kn) {
1388 currentKey = ffjtSearchMetadataMaxID
1389 state = fflib.FFParse_want_colon
1390 goto mainparse
1391 }
1392
1393 if fflib.SimpleLetterEqualFold(ffjKeySearchMetadataCount, kn) {
1394 currentKey = ffjtSearchMetadataCount
1395 state = fflib.FFParse_want_colon
1396 goto mainparse
1397 }
1398
1399 if fflib.AsciiEqualFold(ffjKeySearchMetadataCompletedIn, kn) {
1400 currentKey = ffjtSearchMetadataCompletedIn
1401 state = fflib.FFParse_want_colon
1402 goto mainparse
1403 }
1404
1405 currentKey = ffjtSearchMetadatanosuchkey
1406 state = fflib.FFParse_want_colon
1407 goto mainparse
1408 }
1409
1410 case fflib.FFParse_want_colon:
1411 if tok != fflib.FFTok_colon {
1412 wantedTok = fflib.FFTok_colon
1413 goto wrongtokenerror
1414 }
1415 state = fflib.FFParse_want_value
1416 continue
1417 case fflib.FFParse_want_value:
1418
1419 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
1420 switch currentKey {
1421
1422 case ffjtSearchMetadataCompletedIn:
1423 goto handle_CompletedIn
1424
1425 case ffjtSearchMetadataCount:
1426 goto handle_Count
1427
1428 case ffjtSearchMetadataMaxID:
1429 goto handle_MaxID
1430
1431 case ffjtSearchMetadataMaxIDStr:
1432 goto handle_MaxIDStr
1433
1434 case ffjtSearchMetadataNextResults:
1435 goto handle_NextResults
1436
1437 case ffjtSearchMetadataQuery:
1438 goto handle_Query
1439
1440 case ffjtSearchMetadataRefreshURL:
1441 goto handle_RefreshURL
1442
1443 case ffjtSearchMetadataSinceID:
1444 goto handle_SinceID
1445
1446 case ffjtSearchMetadataSinceIDStr:
1447 goto handle_SinceIDStr
1448
1449 case ffjtSearchMetadatanosuchkey:
1450 err = fs.SkipField(tok)
1451 if err != nil {
1452 return fs.WrapErr(err)
1453 }
1454 state = fflib.FFParse_after_value
1455 goto mainparse
1456 }
1457 } else {
1458 goto wantedvalue
1459 }
1460 }
1461 }
1462
1463 handle_CompletedIn:
1464
1465 /* handler: j.CompletedIn type=float64 kind=float64 quoted=false*/
1466
1467 {
1468 if tok != fflib.FFTok_double && tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
1469 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for float64", tok))
1470 }
1471 }
1472
1473 {
1474
1475 if tok == fflib.FFTok_null {
1476
1477 } else {
1478
1479 tval, err := fflib.ParseFloat(fs.Output.Bytes(), 64)
1480
1481 if err != nil {
1482 return fs.WrapErr(err)
1483 }
1484
1485 j.CompletedIn = float64(tval)
1486
1487 }
1488 }
1489
1490 state = fflib.FFParse_after_value
1491 goto mainparse
1492
1493 handle_Count:
1494
1495 /* handler: j.Count type=int kind=int quoted=false*/
1496
1497 {
1498 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
1499 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
1500 }
1501 }
1502
1503 {
1504
1505 if tok == fflib.FFTok_null {
1506
1507 } else {
1508
1509 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
1510
1511 if err != nil {
1512 return fs.WrapErr(err)
1513 }
1514
1515 j.Count = int(tval)
1516
1517 }
1518 }
1519
1520 state = fflib.FFParse_after_value
1521 goto mainparse
1522
1523 handle_MaxID:
1524
1525 /* handler: j.MaxID type=int64 kind=int64 quoted=false*/
1526
1527 {
1528 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
1529 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok))
1530 }
1531 }
1532
1533 {
1534
1535 if tok == fflib.FFTok_null {
1536
1537 } else {
1538
1539 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
1540
1541 if err != nil {
1542 return fs.WrapErr(err)
1543 }
1544
1545 j.MaxID = int64(tval)
1546
1547 }
1548 }
1549
1550 state = fflib.FFParse_after_value
1551 goto mainparse
1552
1553 handle_MaxIDStr:
1554
1555 /* handler: j.MaxIDStr type=string kind=string quoted=false*/
1556
1557 {
1558
1559 {
1560 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
1561 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
1562 }
1563 }
1564
1565 if tok == fflib.FFTok_null {
1566
1567 } else {
1568
1569 outBuf := fs.Output.Bytes()
1570
1571 j.MaxIDStr = string(string(outBuf))
1572
1573 }
1574 }
1575
1576 state = fflib.FFParse_after_value
1577 goto mainparse
1578
1579 handle_NextResults:
1580
1581 /* handler: j.NextResults type=string kind=string quoted=false*/
1582
1583 {
1584
1585 {
1586 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
1587 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
1588 }
1589 }
1590
1591 if tok == fflib.FFTok_null {
1592
1593 } else {
1594
1595 outBuf := fs.Output.Bytes()
1596
1597 j.NextResults = string(string(outBuf))
1598
1599 }
1600 }
1601
1602 state = fflib.FFParse_after_value
1603 goto mainparse
1604
1605 handle_Query:
1606
1607 /* handler: j.Query type=string kind=string quoted=false*/
1608
1609 {
1610
1611 {
1612 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
1613 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
1614 }
1615 }
1616
1617 if tok == fflib.FFTok_null {
1618
1619 } else {
1620
1621 outBuf := fs.Output.Bytes()
1622
1623 j.Query = string(string(outBuf))
1624
1625 }
1626 }
1627
1628 state = fflib.FFParse_after_value
1629 goto mainparse
1630
1631 handle_RefreshURL:
1632
1633 /* handler: j.RefreshURL type=string kind=string quoted=false*/
1634
1635 {
1636
1637 {
1638 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
1639 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
1640 }
1641 }
1642
1643 if tok == fflib.FFTok_null {
1644
1645 } else {
1646
1647 outBuf := fs.Output.Bytes()
1648
1649 j.RefreshURL = string(string(outBuf))
1650
1651 }
1652 }
1653
1654 state = fflib.FFParse_after_value
1655 goto mainparse
1656
1657 handle_SinceID:
1658
1659 /* handler: j.SinceID type=int64 kind=int64 quoted=false*/
1660
1661 {
1662 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
1663 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok))
1664 }
1665 }
1666
1667 {
1668
1669 if tok == fflib.FFTok_null {
1670
1671 } else {
1672
1673 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
1674
1675 if err != nil {
1676 return fs.WrapErr(err)
1677 }
1678
1679 j.SinceID = int64(tval)
1680
1681 }
1682 }
1683
1684 state = fflib.FFParse_after_value
1685 goto mainparse
1686
1687 handle_SinceIDStr:
1688
1689 /* handler: j.SinceIDStr type=string kind=string quoted=false*/
1690
1691 {
1692
1693 {
1694 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
1695 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
1696 }
1697 }
1698
1699 if tok == fflib.FFTok_null {
1700
1701 } else {
1702
1703 outBuf := fs.Output.Bytes()
1704
1705 j.SinceIDStr = string(string(outBuf))
1706
1707 }
1708 }
1709
1710 state = fflib.FFParse_after_value
1711 goto mainparse
1712
1713 wantedvalue:
1714 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
1715 wrongtokenerror:
1716 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
1717 tokerror:
1718 if fs.BigError != nil {
1719 return fs.WrapErr(fs.BigError)
1720 }
1721 err = fs.Error.ToError()
1722 if err != nil {
1723 return fs.WrapErr(err)
1724 }
1725 panic("ffjson-generated: unreachable, please report bug.")
1726 done:
1727
1728 return nil
1729 }
1730
1731 // MarshalJSON marshal bytes to json - template
1732 func (j *Status) MarshalJSON() ([]byte, error) {
1733 var buf fflib.Buffer
1734 if j == nil {
1735 buf.WriteString("null")
1736 return buf.Bytes(), nil
1737 }
1738 err := j.MarshalJSONBuf(&buf)
1739 if err != nil {
1740 return nil, err
1741 }
1742 return buf.Bytes(), nil
1743 }
1744
1745 // MarshalJSONBuf marshal buff to json - template
1746 func (j *Status) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
1747 if j == nil {
1748 buf.WriteString("null")
1749 return nil
1750 }
1751 var err error
1752 var obj []byte
1753 _ = obj
1754 _ = err
1755 if j.Contributors != nil {
1756 buf.WriteString(`{"contributors":`)
1757 fflib.WriteJsonString(buf, string(*j.Contributors))
1758 } else {
1759 buf.WriteString(`{"contributors":null`)
1760 }
1761 if j.Coordinates != nil {
1762 buf.WriteString(`,"coordinates":`)
1763 fflib.WriteJsonString(buf, string(*j.Coordinates))
1764 } else {
1765 buf.WriteString(`,"coordinates":null`)
1766 }
1767 buf.WriteString(`,"created_at":`)
1768 fflib.WriteJsonString(buf, string(j.CreatedAt))
1769 buf.WriteString(`,"entities":`)
1770
1771 {
1772
1773 err = j.Entities.MarshalJSONBuf(buf)
1774 if err != nil {
1775 return err
1776 }
1777
1778 }
1779 if j.Favorited {
1780 buf.WriteString(`,"favorited":true`)
1781 } else {
1782 buf.WriteString(`,"favorited":false`)
1783 }
1784 if j.Geo != nil {
1785 buf.WriteString(`,"geo":`)
1786 fflib.WriteJsonString(buf, string(*j.Geo))
1787 } else {
1788 buf.WriteString(`,"geo":null`)
1789 }
1790 buf.WriteString(`,"id":`)
1791 fflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)
1792 buf.WriteString(`,"id_str":`)
1793 fflib.WriteJsonString(buf, string(j.IDStr))
1794 if j.InReplyToScreenName != nil {
1795 buf.WriteString(`,"in_reply_to_screen_name":`)
1796 fflib.WriteJsonString(buf, string(*j.InReplyToScreenName))
1797 } else {
1798 buf.WriteString(`,"in_reply_to_screen_name":null`)
1799 }
1800 if j.InReplyToStatusID != nil {
1801 buf.WriteString(`,"in_reply_to_status_id":`)
1802 fflib.WriteJsonString(buf, string(*j.InReplyToStatusID))
1803 } else {
1804 buf.WriteString(`,"in_reply_to_status_id":null`)
1805 }
1806 if j.InReplyToStatusIDStr != nil {
1807 buf.WriteString(`,"in_reply_to_status_id_str":`)
1808 fflib.WriteJsonString(buf, string(*j.InReplyToStatusIDStr))
1809 } else {
1810 buf.WriteString(`,"in_reply_to_status_id_str":null`)
1811 }
1812 if j.InReplyToUserID != nil {
1813 buf.WriteString(`,"in_reply_to_user_id":`)
1814 fflib.WriteJsonString(buf, string(*j.InReplyToUserID))
1815 } else {
1816 buf.WriteString(`,"in_reply_to_user_id":null`)
1817 }
1818 if j.InReplyToUserIDStr != nil {
1819 buf.WriteString(`,"in_reply_to_user_id_str":`)
1820 fflib.WriteJsonString(buf, string(*j.InReplyToUserIDStr))
1821 } else {
1822 buf.WriteString(`,"in_reply_to_user_id_str":null`)
1823 }
1824 buf.WriteString(`,"metadata":`)
1825
1826 {
1827
1828 err = j.Metadata.MarshalJSONBuf(buf)
1829 if err != nil {
1830 return err
1831 }
1832
1833 }
1834 if j.Place != nil {
1835 buf.WriteString(`,"place":`)
1836 fflib.WriteJsonString(buf, string(*j.Place))
1837 } else {
1838 buf.WriteString(`,"place":null`)
1839 }
1840 buf.WriteString(`,"retweet_count":`)
1841 fflib.FormatBits2(buf, uint64(j.RetweetCount), 10, j.RetweetCount < 0)
1842 if j.Retweeted {
1843 buf.WriteString(`,"retweeted":true`)
1844 } else {
1845 buf.WriteString(`,"retweeted":false`)
1846 }
1847 buf.WriteString(`,"source":`)
1848 fflib.WriteJsonString(buf, string(j.Source))
1849 buf.WriteString(`,"text":`)
1850 fflib.WriteJsonString(buf, string(j.Text))
1851 if j.Truncated {
1852 buf.WriteString(`,"truncated":true`)
1853 } else {
1854 buf.WriteString(`,"truncated":false`)
1855 }
1856 buf.WriteString(`,"user":`)
1857
1858 {
1859
1860 err = j.User.MarshalJSONBuf(buf)
1861 if err != nil {
1862 return err
1863 }
1864
1865 }
1866 buf.WriteByte('}')
1867 return nil
1868 }
1869
1870 const (
1871 ffjtStatusbase = iota
1872 ffjtStatusnosuchkey
1873
1874 ffjtStatusContributors
1875
1876 ffjtStatusCoordinates
1877
1878 ffjtStatusCreatedAt
1879
1880 ffjtStatusEntities
1881
1882 ffjtStatusFavorited
1883
1884 ffjtStatusGeo
1885
1886 ffjtStatusID
1887
1888 ffjtStatusIDStr
1889
1890 ffjtStatusInReplyToScreenName
1891
1892 ffjtStatusInReplyToStatusID
1893
1894 ffjtStatusInReplyToStatusIDStr
1895
1896 ffjtStatusInReplyToUserID
1897
1898 ffjtStatusInReplyToUserIDStr
1899
1900 ffjtStatusMetadata
1901
1902 ffjtStatusPlace
1903
1904 ffjtStatusRetweetCount
1905
1906 ffjtStatusRetweeted
1907
1908 ffjtStatusSource
1909
1910 ffjtStatusText
1911
1912 ffjtStatusTruncated
1913
1914 ffjtStatusUser
1915 )
1916
1917 var ffjKeyStatusContributors = []byte("contributors")
1918
1919 var ffjKeyStatusCoordinates = []byte("coordinates")
1920
1921 var ffjKeyStatusCreatedAt = []byte("created_at")
1922
1923 var ffjKeyStatusEntities = []byte("entities")
1924
1925 var ffjKeyStatusFavorited = []byte("favorited")
1926
1927 var ffjKeyStatusGeo = []byte("geo")
1928
1929 var ffjKeyStatusID = []byte("id")
1930
1931 var ffjKeyStatusIDStr = []byte("id_str")
1932
1933 var ffjKeyStatusInReplyToScreenName = []byte("in_reply_to_screen_name")
1934
1935 var ffjKeyStatusInReplyToStatusID = []byte("in_reply_to_status_id")
1936
1937 var ffjKeyStatusInReplyToStatusIDStr = []byte("in_reply_to_status_id_str")
1938
1939 var ffjKeyStatusInReplyToUserID = []byte("in_reply_to_user_id")
1940
1941 var ffjKeyStatusInReplyToUserIDStr = []byte("in_reply_to_user_id_str")
1942
1943 var ffjKeyStatusMetadata = []byte("metadata")
1944
1945 var ffjKeyStatusPlace = []byte("place")
1946
1947 var ffjKeyStatusRetweetCount = []byte("retweet_count")
1948
1949 var ffjKeyStatusRetweeted = []byte("retweeted")
1950
1951 var ffjKeyStatusSource = []byte("source")
1952
1953 var ffjKeyStatusText = []byte("text")
1954
1955 var ffjKeyStatusTruncated = []byte("truncated")
1956
1957 var ffjKeyStatusUser = []byte("user")
1958
1959 // UnmarshalJSON umarshall json - template of ffjson
1960 func (j *Status) UnmarshalJSON(input []byte) error {
1961 fs := fflib.NewFFLexer(input)
1962 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
1963 }
1964
1965 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
1966 func (j *Status) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
1967 var err error
1968 currentKey := ffjtStatusbase
1969 _ = currentKey
1970 tok := fflib.FFTok_init
1971 wantedTok := fflib.FFTok_init
1972
1973 mainparse:
1974 for {
1975 tok = fs.Scan()
1976 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
1977 if tok == fflib.FFTok_error {
1978 goto tokerror
1979 }
1980
1981 switch state {
1982
1983 case fflib.FFParse_map_start:
1984 if tok != fflib.FFTok_left_bracket {
1985 wantedTok = fflib.FFTok_left_bracket
1986 goto wrongtokenerror
1987 }
1988 state = fflib.FFParse_want_key
1989 continue
1990
1991 case fflib.FFParse_after_value:
1992 if tok == fflib.FFTok_comma {
1993 state = fflib.FFParse_want_key
1994 } else if tok == fflib.FFTok_right_bracket {
1995 goto done
1996 } else {
1997 wantedTok = fflib.FFTok_comma
1998 goto wrongtokenerror
1999 }
2000
2001 case fflib.FFParse_want_key:
2002 // json {} ended. goto exit. woo.
2003 if tok == fflib.FFTok_right_bracket {
2004 goto done
2005 }
2006 if tok != fflib.FFTok_string {
2007 wantedTok = fflib.FFTok_string
2008 goto wrongtokenerror
2009 }
2010
2011 kn := fs.Output.Bytes()
2012 if len(kn) <= 0 {
2013 // "" case. hrm.
2014 currentKey = ffjtStatusnosuchkey
2015 state = fflib.FFParse_want_colon
2016 goto mainparse
2017 } else {
2018 switch kn[0] {
2019
2020 case 'c':
2021
2022 if bytes.Equal(ffjKeyStatusContributors, kn) {
2023 currentKey = ffjtStatusContributors
2024 state = fflib.FFParse_want_colon
2025 goto mainparse
2026
2027 } else if bytes.Equal(ffjKeyStatusCoordinates, kn) {
2028 currentKey = ffjtStatusCoordinates
2029 state = fflib.FFParse_want_colon
2030 goto mainparse
2031
2032 } else if bytes.Equal(ffjKeyStatusCreatedAt, kn) {
2033 currentKey = ffjtStatusCreatedAt
2034 state = fflib.FFParse_want_colon
2035 goto mainparse
2036 }
2037
2038 case 'e':
2039
2040 if bytes.Equal(ffjKeyStatusEntities, kn) {
2041 currentKey = ffjtStatusEntities
2042 state = fflib.FFParse_want_colon
2043 goto mainparse
2044 }
2045
2046 case 'f':
2047
2048 if bytes.Equal(ffjKeyStatusFavorited, kn) {
2049 currentKey = ffjtStatusFavorited
2050 state = fflib.FFParse_want_colon
2051 goto mainparse
2052 }
2053
2054 case 'g':
2055
2056 if bytes.Equal(ffjKeyStatusGeo, kn) {
2057 currentKey = ffjtStatusGeo
2058 state = fflib.FFParse_want_colon
2059 goto mainparse
2060 }
2061
2062 case 'i':
2063
2064 if bytes.Equal(ffjKeyStatusID, kn) {
2065 currentKey = ffjtStatusID
2066 state = fflib.FFParse_want_colon
2067 goto mainparse
2068
2069 } else if bytes.Equal(ffjKeyStatusIDStr, kn) {
2070 currentKey = ffjtStatusIDStr
2071 state = fflib.FFParse_want_colon
2072 goto mainparse
2073
2074 } else if bytes.Equal(ffjKeyStatusInReplyToScreenName, kn) {
2075 currentKey = ffjtStatusInReplyToScreenName
2076 state = fflib.FFParse_want_colon
2077 goto mainparse
2078
2079 } else if bytes.Equal(ffjKeyStatusInReplyToStatusID, kn) {
2080 currentKey = ffjtStatusInReplyToStatusID
2081 state = fflib.FFParse_want_colon
2082 goto mainparse
2083
2084 } else if bytes.Equal(ffjKeyStatusInReplyToStatusIDStr, kn) {
2085 currentKey = ffjtStatusInReplyToStatusIDStr
2086 state = fflib.FFParse_want_colon
2087 goto mainparse
2088
2089 } else if bytes.Equal(ffjKeyStatusInReplyToUserID, kn) {
2090 currentKey = ffjtStatusInReplyToUserID
2091 state = fflib.FFParse_want_colon
2092 goto mainparse
2093
2094 } else if bytes.Equal(ffjKeyStatusInReplyToUserIDStr, kn) {
2095 currentKey = ffjtStatusInReplyToUserIDStr
2096 state = fflib.FFParse_want_colon
2097 goto mainparse
2098 }
2099
2100 case 'm':
2101
2102 if bytes.Equal(ffjKeyStatusMetadata, kn) {
2103 currentKey = ffjtStatusMetadata
2104 state = fflib.FFParse_want_colon
2105 goto mainparse
2106 }
2107
2108 case 'p':
2109
2110 if bytes.Equal(ffjKeyStatusPlace, kn) {
2111 currentKey = ffjtStatusPlace
2112 state = fflib.FFParse_want_colon
2113 goto mainparse
2114 }
2115
2116 case 'r':
2117
2118 if bytes.Equal(ffjKeyStatusRetweetCount, kn) {
2119 currentKey = ffjtStatusRetweetCount
2120 state = fflib.FFParse_want_colon
2121 goto mainparse
2122
2123 } else if bytes.Equal(ffjKeyStatusRetweeted, kn) {
2124 currentKey = ffjtStatusRetweeted
2125 state = fflib.FFParse_want_colon
2126 goto mainparse
2127 }
2128
2129 case 's':
2130
2131 if bytes.Equal(ffjKeyStatusSource, kn) {
2132 currentKey = ffjtStatusSource
2133 state = fflib.FFParse_want_colon
2134 goto mainparse
2135 }
2136
2137 case 't':
2138
2139 if bytes.Equal(ffjKeyStatusText, kn) {
2140 currentKey = ffjtStatusText
2141 state = fflib.FFParse_want_colon
2142 goto mainparse
2143
2144 } else if bytes.Equal(ffjKeyStatusTruncated, kn) {
2145 currentKey = ffjtStatusTruncated
2146 state = fflib.FFParse_want_colon
2147 goto mainparse
2148 }
2149
2150 case 'u':
2151
2152 if bytes.Equal(ffjKeyStatusUser, kn) {
2153 currentKey = ffjtStatusUser
2154 state = fflib.FFParse_want_colon
2155 goto mainparse
2156 }
2157
2158 }
2159
2160 if fflib.EqualFoldRight(ffjKeyStatusUser, kn) {
2161 currentKey = ffjtStatusUser
2162 state = fflib.FFParse_want_colon
2163 goto mainparse
2164 }
2165
2166 if fflib.SimpleLetterEqualFold(ffjKeyStatusTruncated, kn) {
2167 currentKey = ffjtStatusTruncated
2168 state = fflib.FFParse_want_colon
2169 goto mainparse
2170 }
2171
2172 if fflib.SimpleLetterEqualFold(ffjKeyStatusText, kn) {
2173 currentKey = ffjtStatusText
2174 state = fflib.FFParse_want_colon
2175 goto mainparse
2176 }
2177
2178 if fflib.EqualFoldRight(ffjKeyStatusSource, kn) {
2179 currentKey = ffjtStatusSource
2180 state = fflib.FFParse_want_colon
2181 goto mainparse
2182 }
2183
2184 if fflib.SimpleLetterEqualFold(ffjKeyStatusRetweeted, kn) {
2185 currentKey = ffjtStatusRetweeted
2186 state = fflib.FFParse_want_colon
2187 goto mainparse
2188 }
2189
2190 if fflib.AsciiEqualFold(ffjKeyStatusRetweetCount, kn) {
2191 currentKey = ffjtStatusRetweetCount
2192 state = fflib.FFParse_want_colon
2193 goto mainparse
2194 }
2195
2196 if fflib.SimpleLetterEqualFold(ffjKeyStatusPlace, kn) {
2197 currentKey = ffjtStatusPlace
2198 state = fflib.FFParse_want_colon
2199 goto mainparse
2200 }
2201
2202 if fflib.SimpleLetterEqualFold(ffjKeyStatusMetadata, kn) {
2203 currentKey = ffjtStatusMetadata
2204 state = fflib.FFParse_want_colon
2205 goto mainparse
2206 }
2207
2208 if fflib.EqualFoldRight(ffjKeyStatusInReplyToUserIDStr, kn) {
2209 currentKey = ffjtStatusInReplyToUserIDStr
2210 state = fflib.FFParse_want_colon
2211 goto mainparse
2212 }
2213
2214 if fflib.EqualFoldRight(ffjKeyStatusInReplyToUserID, kn) {
2215 currentKey = ffjtStatusInReplyToUserID
2216 state = fflib.FFParse_want_colon
2217 goto mainparse
2218 }
2219
2220 if fflib.EqualFoldRight(ffjKeyStatusInReplyToStatusIDStr, kn) {
2221 currentKey = ffjtStatusInReplyToStatusIDStr
2222 state = fflib.FFParse_want_colon
2223 goto mainparse
2224 }
2225
2226 if fflib.EqualFoldRight(ffjKeyStatusInReplyToStatusID, kn) {
2227 currentKey = ffjtStatusInReplyToStatusID
2228 state = fflib.FFParse_want_colon
2229 goto mainparse
2230 }
2231
2232 if fflib.EqualFoldRight(ffjKeyStatusInReplyToScreenName, kn) {
2233 currentKey = ffjtStatusInReplyToScreenName
2234 state = fflib.FFParse_want_colon
2235 goto mainparse
2236 }
2237
2238 if fflib.EqualFoldRight(ffjKeyStatusIDStr, kn) {
2239 currentKey = ffjtStatusIDStr
2240 state = fflib.FFParse_want_colon
2241 goto mainparse
2242 }
2243
2244 if fflib.SimpleLetterEqualFold(ffjKeyStatusID, kn) {
2245 currentKey = ffjtStatusID
2246 state = fflib.FFParse_want_colon
2247 goto mainparse
2248 }
2249
2250 if fflib.SimpleLetterEqualFold(ffjKeyStatusGeo, kn) {
2251 currentKey = ffjtStatusGeo
2252 state = fflib.FFParse_want_colon
2253 goto mainparse
2254 }
2255
2256 if fflib.SimpleLetterEqualFold(ffjKeyStatusFavorited, kn) {
2257 currentKey = ffjtStatusFavorited
2258 state = fflib.FFParse_want_colon
2259 goto mainparse
2260 }
2261
2262 if fflib.EqualFoldRight(ffjKeyStatusEntities, kn) {
2263 currentKey = ffjtStatusEntities
2264 state = fflib.FFParse_want_colon
2265 goto mainparse
2266 }
2267
2268 if fflib.AsciiEqualFold(ffjKeyStatusCreatedAt, kn) {
2269 currentKey = ffjtStatusCreatedAt
2270 state = fflib.FFParse_want_colon
2271 goto mainparse
2272 }
2273
2274 if fflib.EqualFoldRight(ffjKeyStatusCoordinates, kn) {
2275 currentKey = ffjtStatusCoordinates
2276 state = fflib.FFParse_want_colon
2277 goto mainparse
2278 }
2279
2280 if fflib.EqualFoldRight(ffjKeyStatusContributors, kn) {
2281 currentKey = ffjtStatusContributors
2282 state = fflib.FFParse_want_colon
2283 goto mainparse
2284 }
2285
2286 currentKey = ffjtStatusnosuchkey
2287 state = fflib.FFParse_want_colon
2288 goto mainparse
2289 }
2290
2291 case fflib.FFParse_want_colon:
2292 if tok != fflib.FFTok_colon {
2293 wantedTok = fflib.FFTok_colon
2294 goto wrongtokenerror
2295 }
2296 state = fflib.FFParse_want_value
2297 continue
2298 case fflib.FFParse_want_value:
2299
2300 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
2301 switch currentKey {
2302
2303 case ffjtStatusContributors:
2304 goto handle_Contributors
2305
2306 case ffjtStatusCoordinates:
2307 goto handle_Coordinates
2308
2309 case ffjtStatusCreatedAt:
2310 goto handle_CreatedAt
2311
2312 case ffjtStatusEntities:
2313 goto handle_Entities
2314
2315 case ffjtStatusFavorited:
2316 goto handle_Favorited
2317
2318 case ffjtStatusGeo:
2319 goto handle_Geo
2320
2321 case ffjtStatusID:
2322 goto handle_ID
2323
2324 case ffjtStatusIDStr:
2325 goto handle_IDStr
2326
2327 case ffjtStatusInReplyToScreenName:
2328 goto handle_InReplyToScreenName
2329
2330 case ffjtStatusInReplyToStatusID:
2331 goto handle_InReplyToStatusID
2332
2333 case ffjtStatusInReplyToStatusIDStr:
2334 goto handle_InReplyToStatusIDStr
2335
2336 case ffjtStatusInReplyToUserID:
2337 goto handle_InReplyToUserID
2338
2339 case ffjtStatusInReplyToUserIDStr:
2340 goto handle_InReplyToUserIDStr
2341
2342 case ffjtStatusMetadata:
2343 goto handle_Metadata
2344
2345 case ffjtStatusPlace:
2346 goto handle_Place
2347
2348 case ffjtStatusRetweetCount:
2349 goto handle_RetweetCount
2350
2351 case ffjtStatusRetweeted:
2352 goto handle_Retweeted
2353
2354 case ffjtStatusSource:
2355 goto handle_Source
2356
2357 case ffjtStatusText:
2358 goto handle_Text
2359
2360 case ffjtStatusTruncated:
2361 goto handle_Truncated
2362
2363 case ffjtStatusUser:
2364 goto handle_User
2365
2366 case ffjtStatusnosuchkey:
2367 err = fs.SkipField(tok)
2368 if err != nil {
2369 return fs.WrapErr(err)
2370 }
2371 state = fflib.FFParse_after_value
2372 goto mainparse
2373 }
2374 } else {
2375 goto wantedvalue
2376 }
2377 }
2378 }
2379
2380 handle_Contributors:
2381
2382 /* handler: j.Contributors type=string kind=string quoted=false*/
2383
2384 {
2385
2386 {
2387 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2388 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2389 }
2390 }
2391
2392 if tok == fflib.FFTok_null {
2393
2394 j.Contributors = nil
2395
2396 } else {
2397
2398 var tval string
2399 outBuf := fs.Output.Bytes()
2400
2401 tval = string(string(outBuf))
2402 j.Contributors = &tval
2403
2404 }
2405 }
2406
2407 state = fflib.FFParse_after_value
2408 goto mainparse
2409
2410 handle_Coordinates:
2411
2412 /* handler: j.Coordinates type=string kind=string quoted=false*/
2413
2414 {
2415
2416 {
2417 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2418 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2419 }
2420 }
2421
2422 if tok == fflib.FFTok_null {
2423
2424 j.Coordinates = nil
2425
2426 } else {
2427
2428 var tval string
2429 outBuf := fs.Output.Bytes()
2430
2431 tval = string(string(outBuf))
2432 j.Coordinates = &tval
2433
2434 }
2435 }
2436
2437 state = fflib.FFParse_after_value
2438 goto mainparse
2439
2440 handle_CreatedAt:
2441
2442 /* handler: j.CreatedAt type=string kind=string quoted=false*/
2443
2444 {
2445
2446 {
2447 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2448 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2449 }
2450 }
2451
2452 if tok == fflib.FFTok_null {
2453
2454 } else {
2455
2456 outBuf := fs.Output.Bytes()
2457
2458 j.CreatedAt = string(string(outBuf))
2459
2460 }
2461 }
2462
2463 state = fflib.FFParse_after_value
2464 goto mainparse
2465
2466 handle_Entities:
2467
2468 /* handler: j.Entities type=benchmark.Entities kind=struct quoted=false*/
2469
2470 {
2471 if tok == fflib.FFTok_null {
2472
2473 } else {
2474
2475 err = j.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
2476 if err != nil {
2477 return err
2478 }
2479 }
2480 state = fflib.FFParse_after_value
2481 }
2482
2483 state = fflib.FFParse_after_value
2484 goto mainparse
2485
2486 handle_Favorited:
2487
2488 /* handler: j.Favorited type=bool kind=bool quoted=false*/
2489
2490 {
2491 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
2492 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
2493 }
2494 }
2495
2496 {
2497 if tok == fflib.FFTok_null {
2498
2499 } else {
2500 tmpb := fs.Output.Bytes()
2501
2502 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
2503
2504 j.Favorited = true
2505
2506 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
2507
2508 j.Favorited = false
2509
2510 } else {
2511 err = errors.New("unexpected bytes for true/false value")
2512 return fs.WrapErr(err)
2513 }
2514
2515 }
2516 }
2517
2518 state = fflib.FFParse_after_value
2519 goto mainparse
2520
2521 handle_Geo:
2522
2523 /* handler: j.Geo type=string kind=string quoted=false*/
2524
2525 {
2526
2527 {
2528 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2529 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2530 }
2531 }
2532
2533 if tok == fflib.FFTok_null {
2534
2535 j.Geo = nil
2536
2537 } else {
2538
2539 var tval string
2540 outBuf := fs.Output.Bytes()
2541
2542 tval = string(string(outBuf))
2543 j.Geo = &tval
2544
2545 }
2546 }
2547
2548 state = fflib.FFParse_after_value
2549 goto mainparse
2550
2551 handle_ID:
2552
2553 /* handler: j.ID type=int64 kind=int64 quoted=false*/
2554
2555 {
2556 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
2557 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok))
2558 }
2559 }
2560
2561 {
2562
2563 if tok == fflib.FFTok_null {
2564
2565 } else {
2566
2567 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
2568
2569 if err != nil {
2570 return fs.WrapErr(err)
2571 }
2572
2573 j.ID = int64(tval)
2574
2575 }
2576 }
2577
2578 state = fflib.FFParse_after_value
2579 goto mainparse
2580
2581 handle_IDStr:
2582
2583 /* handler: j.IDStr type=string kind=string quoted=false*/
2584
2585 {
2586
2587 {
2588 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2589 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2590 }
2591 }
2592
2593 if tok == fflib.FFTok_null {
2594
2595 } else {
2596
2597 outBuf := fs.Output.Bytes()
2598
2599 j.IDStr = string(string(outBuf))
2600
2601 }
2602 }
2603
2604 state = fflib.FFParse_after_value
2605 goto mainparse
2606
2607 handle_InReplyToScreenName:
2608
2609 /* handler: j.InReplyToScreenName type=string kind=string quoted=false*/
2610
2611 {
2612
2613 {
2614 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2615 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2616 }
2617 }
2618
2619 if tok == fflib.FFTok_null {
2620
2621 j.InReplyToScreenName = nil
2622
2623 } else {
2624
2625 var tval string
2626 outBuf := fs.Output.Bytes()
2627
2628 tval = string(string(outBuf))
2629 j.InReplyToScreenName = &tval
2630
2631 }
2632 }
2633
2634 state = fflib.FFParse_after_value
2635 goto mainparse
2636
2637 handle_InReplyToStatusID:
2638
2639 /* handler: j.InReplyToStatusID type=string kind=string quoted=false*/
2640
2641 {
2642
2643 {
2644 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2645 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2646 }
2647 }
2648
2649 if tok == fflib.FFTok_null {
2650
2651 j.InReplyToStatusID = nil
2652
2653 } else {
2654
2655 var tval string
2656 outBuf := fs.Output.Bytes()
2657
2658 tval = string(string(outBuf))
2659 j.InReplyToStatusID = &tval
2660
2661 }
2662 }
2663
2664 state = fflib.FFParse_after_value
2665 goto mainparse
2666
2667 handle_InReplyToStatusIDStr:
2668
2669 /* handler: j.InReplyToStatusIDStr type=string kind=string quoted=false*/
2670
2671 {
2672
2673 {
2674 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2675 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2676 }
2677 }
2678
2679 if tok == fflib.FFTok_null {
2680
2681 j.InReplyToStatusIDStr = nil
2682
2683 } else {
2684
2685 var tval string
2686 outBuf := fs.Output.Bytes()
2687
2688 tval = string(string(outBuf))
2689 j.InReplyToStatusIDStr = &tval
2690
2691 }
2692 }
2693
2694 state = fflib.FFParse_after_value
2695 goto mainparse
2696
2697 handle_InReplyToUserID:
2698
2699 /* handler: j.InReplyToUserID type=string kind=string quoted=false*/
2700
2701 {
2702
2703 {
2704 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2705 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2706 }
2707 }
2708
2709 if tok == fflib.FFTok_null {
2710
2711 j.InReplyToUserID = nil
2712
2713 } else {
2714
2715 var tval string
2716 outBuf := fs.Output.Bytes()
2717
2718 tval = string(string(outBuf))
2719 j.InReplyToUserID = &tval
2720
2721 }
2722 }
2723
2724 state = fflib.FFParse_after_value
2725 goto mainparse
2726
2727 handle_InReplyToUserIDStr:
2728
2729 /* handler: j.InReplyToUserIDStr type=string kind=string quoted=false*/
2730
2731 {
2732
2733 {
2734 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2735 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2736 }
2737 }
2738
2739 if tok == fflib.FFTok_null {
2740
2741 j.InReplyToUserIDStr = nil
2742
2743 } else {
2744
2745 var tval string
2746 outBuf := fs.Output.Bytes()
2747
2748 tval = string(string(outBuf))
2749 j.InReplyToUserIDStr = &tval
2750
2751 }
2752 }
2753
2754 state = fflib.FFParse_after_value
2755 goto mainparse
2756
2757 handle_Metadata:
2758
2759 /* handler: j.Metadata type=benchmark.StatusMetadata kind=struct quoted=false*/
2760
2761 {
2762 if tok == fflib.FFTok_null {
2763
2764 } else {
2765
2766 err = j.Metadata.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
2767 if err != nil {
2768 return err
2769 }
2770 }
2771 state = fflib.FFParse_after_value
2772 }
2773
2774 state = fflib.FFParse_after_value
2775 goto mainparse
2776
2777 handle_Place:
2778
2779 /* handler: j.Place type=string kind=string quoted=false*/
2780
2781 {
2782
2783 {
2784 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2785 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2786 }
2787 }
2788
2789 if tok == fflib.FFTok_null {
2790
2791 j.Place = nil
2792
2793 } else {
2794
2795 var tval string
2796 outBuf := fs.Output.Bytes()
2797
2798 tval = string(string(outBuf))
2799 j.Place = &tval
2800
2801 }
2802 }
2803
2804 state = fflib.FFParse_after_value
2805 goto mainparse
2806
2807 handle_RetweetCount:
2808
2809 /* handler: j.RetweetCount type=int kind=int quoted=false*/
2810
2811 {
2812 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
2813 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
2814 }
2815 }
2816
2817 {
2818
2819 if tok == fflib.FFTok_null {
2820
2821 } else {
2822
2823 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
2824
2825 if err != nil {
2826 return fs.WrapErr(err)
2827 }
2828
2829 j.RetweetCount = int(tval)
2830
2831 }
2832 }
2833
2834 state = fflib.FFParse_after_value
2835 goto mainparse
2836
2837 handle_Retweeted:
2838
2839 /* handler: j.Retweeted type=bool kind=bool quoted=false*/
2840
2841 {
2842 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
2843 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
2844 }
2845 }
2846
2847 {
2848 if tok == fflib.FFTok_null {
2849
2850 } else {
2851 tmpb := fs.Output.Bytes()
2852
2853 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
2854
2855 j.Retweeted = true
2856
2857 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
2858
2859 j.Retweeted = false
2860
2861 } else {
2862 err = errors.New("unexpected bytes for true/false value")
2863 return fs.WrapErr(err)
2864 }
2865
2866 }
2867 }
2868
2869 state = fflib.FFParse_after_value
2870 goto mainparse
2871
2872 handle_Source:
2873
2874 /* handler: j.Source type=string kind=string quoted=false*/
2875
2876 {
2877
2878 {
2879 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2880 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2881 }
2882 }
2883
2884 if tok == fflib.FFTok_null {
2885
2886 } else {
2887
2888 outBuf := fs.Output.Bytes()
2889
2890 j.Source = string(string(outBuf))
2891
2892 }
2893 }
2894
2895 state = fflib.FFParse_after_value
2896 goto mainparse
2897
2898 handle_Text:
2899
2900 /* handler: j.Text type=string kind=string quoted=false*/
2901
2902 {
2903
2904 {
2905 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
2906 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
2907 }
2908 }
2909
2910 if tok == fflib.FFTok_null {
2911
2912 } else {
2913
2914 outBuf := fs.Output.Bytes()
2915
2916 j.Text = string(string(outBuf))
2917
2918 }
2919 }
2920
2921 state = fflib.FFParse_after_value
2922 goto mainparse
2923
2924 handle_Truncated:
2925
2926 /* handler: j.Truncated type=bool kind=bool quoted=false*/
2927
2928 {
2929 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
2930 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
2931 }
2932 }
2933
2934 {
2935 if tok == fflib.FFTok_null {
2936
2937 } else {
2938 tmpb := fs.Output.Bytes()
2939
2940 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
2941
2942 j.Truncated = true
2943
2944 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
2945
2946 j.Truncated = false
2947
2948 } else {
2949 err = errors.New("unexpected bytes for true/false value")
2950 return fs.WrapErr(err)
2951 }
2952
2953 }
2954 }
2955
2956 state = fflib.FFParse_after_value
2957 goto mainparse
2958
2959 handle_User:
2960
2961 /* handler: j.User type=benchmark.User kind=struct quoted=false*/
2962
2963 {
2964 if tok == fflib.FFTok_null {
2965
2966 } else {
2967
2968 err = j.User.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
2969 if err != nil {
2970 return err
2971 }
2972 }
2973 state = fflib.FFParse_after_value
2974 }
2975
2976 state = fflib.FFParse_after_value
2977 goto mainparse
2978
2979 wantedvalue:
2980 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
2981 wrongtokenerror:
2982 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
2983 tokerror:
2984 if fs.BigError != nil {
2985 return fs.WrapErr(fs.BigError)
2986 }
2987 err = fs.Error.ToError()
2988 if err != nil {
2989 return fs.WrapErr(err)
2990 }
2991 panic("ffjson-generated: unreachable, please report bug.")
2992 done:
2993
2994 return nil
2995 }
2996
2997 // MarshalJSON marshal bytes to json - template
2998 func (j *StatusMetadata) MarshalJSON() ([]byte, error) {
2999 var buf fflib.Buffer
3000 if j == nil {
3001 buf.WriteString("null")
3002 return buf.Bytes(), nil
3003 }
3004 err := j.MarshalJSONBuf(&buf)
3005 if err != nil {
3006 return nil, err
3007 }
3008 return buf.Bytes(), nil
3009 }
3010
3011 // MarshalJSONBuf marshal buff to json - template
3012 func (j *StatusMetadata) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
3013 if j == nil {
3014 buf.WriteString("null")
3015 return nil
3016 }
3017 var err error
3018 var obj []byte
3019 _ = obj
3020 _ = err
3021 buf.WriteString(`{"iso_language_code":`)
3022 fflib.WriteJsonString(buf, string(j.IsoLanguageCode))
3023 buf.WriteString(`,"result_type":`)
3024 fflib.WriteJsonString(buf, string(j.ResultType))
3025 buf.WriteByte('}')
3026 return nil
3027 }
3028
3029 const (
3030 ffjtStatusMetadatabase = iota
3031 ffjtStatusMetadatanosuchkey
3032
3033 ffjtStatusMetadataIsoLanguageCode
3034
3035 ffjtStatusMetadataResultType
3036 )
3037
3038 var ffjKeyStatusMetadataIsoLanguageCode = []byte("iso_language_code")
3039
3040 var ffjKeyStatusMetadataResultType = []byte("result_type")
3041
3042 // UnmarshalJSON umarshall json - template of ffjson
3043 func (j *StatusMetadata) UnmarshalJSON(input []byte) error {
3044 fs := fflib.NewFFLexer(input)
3045 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
3046 }
3047
3048 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
3049 func (j *StatusMetadata) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
3050 var err error
3051 currentKey := ffjtStatusMetadatabase
3052 _ = currentKey
3053 tok := fflib.FFTok_init
3054 wantedTok := fflib.FFTok_init
3055
3056 mainparse:
3057 for {
3058 tok = fs.Scan()
3059 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
3060 if tok == fflib.FFTok_error {
3061 goto tokerror
3062 }
3063
3064 switch state {
3065
3066 case fflib.FFParse_map_start:
3067 if tok != fflib.FFTok_left_bracket {
3068 wantedTok = fflib.FFTok_left_bracket
3069 goto wrongtokenerror
3070 }
3071 state = fflib.FFParse_want_key
3072 continue
3073
3074 case fflib.FFParse_after_value:
3075 if tok == fflib.FFTok_comma {
3076 state = fflib.FFParse_want_key
3077 } else if tok == fflib.FFTok_right_bracket {
3078 goto done
3079 } else {
3080 wantedTok = fflib.FFTok_comma
3081 goto wrongtokenerror
3082 }
3083
3084 case fflib.FFParse_want_key:
3085 // json {} ended. goto exit. woo.
3086 if tok == fflib.FFTok_right_bracket {
3087 goto done
3088 }
3089 if tok != fflib.FFTok_string {
3090 wantedTok = fflib.FFTok_string
3091 goto wrongtokenerror
3092 }
3093
3094 kn := fs.Output.Bytes()
3095 if len(kn) <= 0 {
3096 // "" case. hrm.
3097 currentKey = ffjtStatusMetadatanosuchkey
3098 state = fflib.FFParse_want_colon
3099 goto mainparse
3100 } else {
3101 switch kn[0] {
3102
3103 case 'i':
3104
3105 if bytes.Equal(ffjKeyStatusMetadataIsoLanguageCode, kn) {
3106 currentKey = ffjtStatusMetadataIsoLanguageCode
3107 state = fflib.FFParse_want_colon
3108 goto mainparse
3109 }
3110
3111 case 'r':
3112
3113 if bytes.Equal(ffjKeyStatusMetadataResultType, kn) {
3114 currentKey = ffjtStatusMetadataResultType
3115 state = fflib.FFParse_want_colon
3116 goto mainparse
3117 }
3118
3119 }
3120
3121 if fflib.EqualFoldRight(ffjKeyStatusMetadataResultType, kn) {
3122 currentKey = ffjtStatusMetadataResultType
3123 state = fflib.FFParse_want_colon
3124 goto mainparse
3125 }
3126
3127 if fflib.EqualFoldRight(ffjKeyStatusMetadataIsoLanguageCode, kn) {
3128 currentKey = ffjtStatusMetadataIsoLanguageCode
3129 state = fflib.FFParse_want_colon
3130 goto mainparse
3131 }
3132
3133 currentKey = ffjtStatusMetadatanosuchkey
3134 state = fflib.FFParse_want_colon
3135 goto mainparse
3136 }
3137
3138 case fflib.FFParse_want_colon:
3139 if tok != fflib.FFTok_colon {
3140 wantedTok = fflib.FFTok_colon
3141 goto wrongtokenerror
3142 }
3143 state = fflib.FFParse_want_value
3144 continue
3145 case fflib.FFParse_want_value:
3146
3147 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
3148 switch currentKey {
3149
3150 case ffjtStatusMetadataIsoLanguageCode:
3151 goto handle_IsoLanguageCode
3152
3153 case ffjtStatusMetadataResultType:
3154 goto handle_ResultType
3155
3156 case ffjtStatusMetadatanosuchkey:
3157 err = fs.SkipField(tok)
3158 if err != nil {
3159 return fs.WrapErr(err)
3160 }
3161 state = fflib.FFParse_after_value
3162 goto mainparse
3163 }
3164 } else {
3165 goto wantedvalue
3166 }
3167 }
3168 }
3169
3170 handle_IsoLanguageCode:
3171
3172 /* handler: j.IsoLanguageCode type=string kind=string quoted=false*/
3173
3174 {
3175
3176 {
3177 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
3178 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
3179 }
3180 }
3181
3182 if tok == fflib.FFTok_null {
3183
3184 } else {
3185
3186 outBuf := fs.Output.Bytes()
3187
3188 j.IsoLanguageCode = string(string(outBuf))
3189
3190 }
3191 }
3192
3193 state = fflib.FFParse_after_value
3194 goto mainparse
3195
3196 handle_ResultType:
3197
3198 /* handler: j.ResultType type=string kind=string quoted=false*/
3199
3200 {
3201
3202 {
3203 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
3204 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
3205 }
3206 }
3207
3208 if tok == fflib.FFTok_null {
3209
3210 } else {
3211
3212 outBuf := fs.Output.Bytes()
3213
3214 j.ResultType = string(string(outBuf))
3215
3216 }
3217 }
3218
3219 state = fflib.FFParse_after_value
3220 goto mainparse
3221
3222 wantedvalue:
3223 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
3224 wrongtokenerror:
3225 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
3226 tokerror:
3227 if fs.BigError != nil {
3228 return fs.WrapErr(fs.BigError)
3229 }
3230 err = fs.Error.ToError()
3231 if err != nil {
3232 return fs.WrapErr(err)
3233 }
3234 panic("ffjson-generated: unreachable, please report bug.")
3235 done:
3236
3237 return nil
3238 }
3239
3240 // MarshalJSON marshal bytes to json - template
3241 func (j *URL) MarshalJSON() ([]byte, error) {
3242 var buf fflib.Buffer
3243 if j == nil {
3244 buf.WriteString("null")
3245 return buf.Bytes(), nil
3246 }
3247 err := j.MarshalJSONBuf(&buf)
3248 if err != nil {
3249 return nil, err
3250 }
3251 return buf.Bytes(), nil
3252 }
3253
3254 // MarshalJSONBuf marshal buff to json - template
3255 func (j *URL) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
3256 if j == nil {
3257 buf.WriteString("null")
3258 return nil
3259 }
3260 var err error
3261 var obj []byte
3262 _ = obj
3263 _ = err
3264 if j.ExpandedURL != nil {
3265 buf.WriteString(`{"expanded_url":`)
3266 fflib.WriteJsonString(buf, string(*j.ExpandedURL))
3267 } else {
3268 buf.WriteString(`{"expanded_url":null`)
3269 }
3270 buf.WriteString(`,"indices":`)
3271 if j.Indices != nil {
3272 buf.WriteString(`[`)
3273 for i, v := range j.Indices {
3274 if i != 0 {
3275 buf.WriteString(`,`)
3276 }
3277 fflib.FormatBits2(buf, uint64(v), 10, v < 0)
3278 }
3279 buf.WriteString(`]`)
3280 } else {
3281 buf.WriteString(`null`)
3282 }
3283 buf.WriteString(`,"url":`)
3284 fflib.WriteJsonString(buf, string(j.URL))
3285 buf.WriteByte('}')
3286 return nil
3287 }
3288
3289 const (
3290 ffjtURLbase = iota
3291 ffjtURLnosuchkey
3292
3293 ffjtURLExpandedURL
3294
3295 ffjtURLIndices
3296
3297 ffjtURLURL
3298 )
3299
3300 var ffjKeyURLExpandedURL = []byte("expanded_url")
3301
3302 var ffjKeyURLIndices = []byte("indices")
3303
3304 var ffjKeyURLURL = []byte("url")
3305
3306 // UnmarshalJSON umarshall json - template of ffjson
3307 func (j *URL) UnmarshalJSON(input []byte) error {
3308 fs := fflib.NewFFLexer(input)
3309 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
3310 }
3311
3312 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
3313 func (j *URL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
3314 var err error
3315 currentKey := ffjtURLbase
3316 _ = currentKey
3317 tok := fflib.FFTok_init
3318 wantedTok := fflib.FFTok_init
3319
3320 mainparse:
3321 for {
3322 tok = fs.Scan()
3323 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
3324 if tok == fflib.FFTok_error {
3325 goto tokerror
3326 }
3327
3328 switch state {
3329
3330 case fflib.FFParse_map_start:
3331 if tok != fflib.FFTok_left_bracket {
3332 wantedTok = fflib.FFTok_left_bracket
3333 goto wrongtokenerror
3334 }
3335 state = fflib.FFParse_want_key
3336 continue
3337
3338 case fflib.FFParse_after_value:
3339 if tok == fflib.FFTok_comma {
3340 state = fflib.FFParse_want_key
3341 } else if tok == fflib.FFTok_right_bracket {
3342 goto done
3343 } else {
3344 wantedTok = fflib.FFTok_comma
3345 goto wrongtokenerror
3346 }
3347
3348 case fflib.FFParse_want_key:
3349 // json {} ended. goto exit. woo.
3350 if tok == fflib.FFTok_right_bracket {
3351 goto done
3352 }
3353 if tok != fflib.FFTok_string {
3354 wantedTok = fflib.FFTok_string
3355 goto wrongtokenerror
3356 }
3357
3358 kn := fs.Output.Bytes()
3359 if len(kn) <= 0 {
3360 // "" case. hrm.
3361 currentKey = ffjtURLnosuchkey
3362 state = fflib.FFParse_want_colon
3363 goto mainparse
3364 } else {
3365 switch kn[0] {
3366
3367 case 'e':
3368
3369 if bytes.Equal(ffjKeyURLExpandedURL, kn) {
3370 currentKey = ffjtURLExpandedURL
3371 state = fflib.FFParse_want_colon
3372 goto mainparse
3373 }
3374
3375 case 'i':
3376
3377 if bytes.Equal(ffjKeyURLIndices, kn) {
3378 currentKey = ffjtURLIndices
3379 state = fflib.FFParse_want_colon
3380 goto mainparse
3381 }
3382
3383 case 'u':
3384
3385 if bytes.Equal(ffjKeyURLURL, kn) {
3386 currentKey = ffjtURLURL
3387 state = fflib.FFParse_want_colon
3388 goto mainparse
3389 }
3390
3391 }
3392
3393 if fflib.SimpleLetterEqualFold(ffjKeyURLURL, kn) {
3394 currentKey = ffjtURLURL
3395 state = fflib.FFParse_want_colon
3396 goto mainparse
3397 }
3398
3399 if fflib.EqualFoldRight(ffjKeyURLIndices, kn) {
3400 currentKey = ffjtURLIndices
3401 state = fflib.FFParse_want_colon
3402 goto mainparse
3403 }
3404
3405 if fflib.AsciiEqualFold(ffjKeyURLExpandedURL, kn) {
3406 currentKey = ffjtURLExpandedURL
3407 state = fflib.FFParse_want_colon
3408 goto mainparse
3409 }
3410
3411 currentKey = ffjtURLnosuchkey
3412 state = fflib.FFParse_want_colon
3413 goto mainparse
3414 }
3415
3416 case fflib.FFParse_want_colon:
3417 if tok != fflib.FFTok_colon {
3418 wantedTok = fflib.FFTok_colon
3419 goto wrongtokenerror
3420 }
3421 state = fflib.FFParse_want_value
3422 continue
3423 case fflib.FFParse_want_value:
3424
3425 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
3426 switch currentKey {
3427
3428 case ffjtURLExpandedURL:
3429 goto handle_ExpandedURL
3430
3431 case ffjtURLIndices:
3432 goto handle_Indices
3433
3434 case ffjtURLURL:
3435 goto handle_URL
3436
3437 case ffjtURLnosuchkey:
3438 err = fs.SkipField(tok)
3439 if err != nil {
3440 return fs.WrapErr(err)
3441 }
3442 state = fflib.FFParse_after_value
3443 goto mainparse
3444 }
3445 } else {
3446 goto wantedvalue
3447 }
3448 }
3449 }
3450
3451 handle_ExpandedURL:
3452
3453 /* handler: j.ExpandedURL type=string kind=string quoted=false*/
3454
3455 {
3456
3457 {
3458 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
3459 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
3460 }
3461 }
3462
3463 if tok == fflib.FFTok_null {
3464
3465 j.ExpandedURL = nil
3466
3467 } else {
3468
3469 var tval string
3470 outBuf := fs.Output.Bytes()
3471
3472 tval = string(string(outBuf))
3473 j.ExpandedURL = &tval
3474
3475 }
3476 }
3477
3478 state = fflib.FFParse_after_value
3479 goto mainparse
3480
3481 handle_Indices:
3482
3483 /* handler: j.Indices type=[]int kind=slice quoted=false*/
3484
3485 {
3486
3487 {
3488 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
3489 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
3490 }
3491 }
3492
3493 if tok == fflib.FFTok_null {
3494 j.Indices = nil
3495 } else {
3496
3497 j.Indices = []int{}
3498
3499 wantVal := true
3500
3501 for {
3502
3503 var tmpJIndices int
3504
3505 tok = fs.Scan()
3506 if tok == fflib.FFTok_error {
3507 goto tokerror
3508 }
3509 if tok == fflib.FFTok_right_brace {
3510 break
3511 }
3512
3513 if tok == fflib.FFTok_comma {
3514 if wantVal == true {
3515 // TODO(pquerna): this isn't an ideal error message, this handles
3516 // things like [,,,] as an array value.
3517 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
3518 }
3519 continue
3520 } else {
3521 wantVal = true
3522 }
3523
3524 /* handler: tmpJIndices type=int kind=int quoted=false*/
3525
3526 {
3527 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
3528 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
3529 }
3530 }
3531
3532 {
3533
3534 if tok == fflib.FFTok_null {
3535
3536 } else {
3537
3538 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
3539
3540 if err != nil {
3541 return fs.WrapErr(err)
3542 }
3543
3544 tmpJIndices = int(tval)
3545
3546 }
3547 }
3548
3549 j.Indices = append(j.Indices, tmpJIndices)
3550
3551 wantVal = false
3552 }
3553 }
3554 }
3555
3556 state = fflib.FFParse_after_value
3557 goto mainparse
3558
3559 handle_URL:
3560
3561 /* handler: j.URL type=string kind=string quoted=false*/
3562
3563 {
3564
3565 {
3566 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
3567 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
3568 }
3569 }
3570
3571 if tok == fflib.FFTok_null {
3572
3573 } else {
3574
3575 outBuf := fs.Output.Bytes()
3576
3577 j.URL = string(string(outBuf))
3578
3579 }
3580 }
3581
3582 state = fflib.FFParse_after_value
3583 goto mainparse
3584
3585 wantedvalue:
3586 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
3587 wrongtokenerror:
3588 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
3589 tokerror:
3590 if fs.BigError != nil {
3591 return fs.WrapErr(fs.BigError)
3592 }
3593 err = fs.Error.ToError()
3594 if err != nil {
3595 return fs.WrapErr(err)
3596 }
3597 panic("ffjson-generated: unreachable, please report bug.")
3598 done:
3599
3600 return nil
3601 }
3602
3603 // MarshalJSON marshal bytes to json - template
3604 func (j *User) MarshalJSON() ([]byte, error) {
3605 var buf fflib.Buffer
3606 if j == nil {
3607 buf.WriteString("null")
3608 return buf.Bytes(), nil
3609 }
3610 err := j.MarshalJSONBuf(&buf)
3611 if err != nil {
3612 return nil, err
3613 }
3614 return buf.Bytes(), nil
3615 }
3616
3617 // MarshalJSONBuf marshal buff to json - template
3618 func (j *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
3619 if j == nil {
3620 buf.WriteString("null")
3621 return nil
3622 }
3623 var err error
3624 var obj []byte
3625 _ = obj
3626 _ = err
3627 if j.ContributorsEnabled {
3628 buf.WriteString(`{"contributors_enabled":true`)
3629 } else {
3630 buf.WriteString(`{"contributors_enabled":false`)
3631 }
3632 buf.WriteString(`,"created_at":`)
3633 fflib.WriteJsonString(buf, string(j.CreatedAt))
3634 if j.DefaultProfile {
3635 buf.WriteString(`,"default_profile":true`)
3636 } else {
3637 buf.WriteString(`,"default_profile":false`)
3638 }
3639 if j.DefaultProfileImage {
3640 buf.WriteString(`,"default_profile_image":true`)
3641 } else {
3642 buf.WriteString(`,"default_profile_image":false`)
3643 }
3644 buf.WriteString(`,"description":`)
3645 fflib.WriteJsonString(buf, string(j.Description))
3646 buf.WriteString(`,"entities":`)
3647
3648 {
3649
3650 err = j.Entities.MarshalJSONBuf(buf)
3651 if err != nil {
3652 return err
3653 }
3654
3655 }
3656 buf.WriteString(`,"favourites_count":`)
3657 fflib.FormatBits2(buf, uint64(j.FavouritesCount), 10, j.FavouritesCount < 0)
3658 if j.FollowRequestSent != nil {
3659 buf.WriteString(`,"follow_request_sent":`)
3660 fflib.WriteJsonString(buf, string(*j.FollowRequestSent))
3661 } else {
3662 buf.WriteString(`,"follow_request_sent":null`)
3663 }
3664 buf.WriteString(`,"followers_count":`)
3665 fflib.FormatBits2(buf, uint64(j.FollowersCount), 10, j.FollowersCount < 0)
3666 if j.Following != nil {
3667 buf.WriteString(`,"following":`)
3668 fflib.WriteJsonString(buf, string(*j.Following))
3669 } else {
3670 buf.WriteString(`,"following":null`)
3671 }
3672 buf.WriteString(`,"friends_count":`)
3673 fflib.FormatBits2(buf, uint64(j.FriendsCount), 10, j.FriendsCount < 0)
3674 if j.GeoEnabled {
3675 buf.WriteString(`,"geo_enabled":true`)
3676 } else {
3677 buf.WriteString(`,"geo_enabled":false`)
3678 }
3679 buf.WriteString(`,"id":`)
3680 fflib.FormatBits2(buf, uint64(j.ID), 10, j.ID < 0)
3681 buf.WriteString(`,"id_str":`)
3682 fflib.WriteJsonString(buf, string(j.IDStr))
3683 if j.IsTranslator {
3684 buf.WriteString(`,"is_translator":true`)
3685 } else {
3686 buf.WriteString(`,"is_translator":false`)
3687 }
3688 buf.WriteString(`,"lang":`)
3689 fflib.WriteJsonString(buf, string(j.Lang))
3690 buf.WriteString(`,"listed_count":`)
3691 fflib.FormatBits2(buf, uint64(j.ListedCount), 10, j.ListedCount < 0)
3692 buf.WriteString(`,"location":`)
3693 fflib.WriteJsonString(buf, string(j.Location))
3694 buf.WriteString(`,"name":`)
3695 fflib.WriteJsonString(buf, string(j.Name))
3696 if j.Notifications != nil {
3697 buf.WriteString(`,"notifications":`)
3698 fflib.WriteJsonString(buf, string(*j.Notifications))
3699 } else {
3700 buf.WriteString(`,"notifications":null`)
3701 }
3702 buf.WriteString(`,"profile_background_color":`)
3703 fflib.WriteJsonString(buf, string(j.ProfileBackgroundColor))
3704 buf.WriteString(`,"profile_background_image_url":`)
3705 fflib.WriteJsonString(buf, string(j.ProfileBackgroundImageURL))
3706 buf.WriteString(`,"profile_background_image_url_https":`)
3707 fflib.WriteJsonString(buf, string(j.ProfileBackgroundImageURLHTTPS))
3708 if j.ProfileBackgroundTile {
3709 buf.WriteString(`,"profile_background_tile":true`)
3710 } else {
3711 buf.WriteString(`,"profile_background_tile":false`)
3712 }
3713 buf.WriteString(`,"profile_image_url":`)
3714 fflib.WriteJsonString(buf, string(j.ProfileImageURL))
3715 buf.WriteString(`,"profile_image_url_https":`)
3716 fflib.WriteJsonString(buf, string(j.ProfileImageURLHTTPS))
3717 buf.WriteString(`,"profile_link_color":`)
3718 fflib.WriteJsonString(buf, string(j.ProfileLinkColor))
3719 buf.WriteString(`,"profile_sidebar_border_color":`)
3720 fflib.WriteJsonString(buf, string(j.ProfileSidebarBorderColor))
3721 buf.WriteString(`,"profile_sidebar_fill_color":`)
3722 fflib.WriteJsonString(buf, string(j.ProfileSidebarFillColor))
3723 buf.WriteString(`,"profile_text_color":`)
3724 fflib.WriteJsonString(buf, string(j.ProfileTextColor))
3725 if j.ProfileUseBackgroundImage {
3726 buf.WriteString(`,"profile_use_background_image":true`)
3727 } else {
3728 buf.WriteString(`,"profile_use_background_image":false`)
3729 }
3730 if j.Protected {
3731 buf.WriteString(`,"protected":true`)
3732 } else {
3733 buf.WriteString(`,"protected":false`)
3734 }
3735 buf.WriteString(`,"screen_name":`)
3736 fflib.WriteJsonString(buf, string(j.ScreenName))
3737 if j.ShowAllInlineMedia {
3738 buf.WriteString(`,"show_all_inline_media":true`)
3739 } else {
3740 buf.WriteString(`,"show_all_inline_media":false`)
3741 }
3742 buf.WriteString(`,"statuses_count":`)
3743 fflib.FormatBits2(buf, uint64(j.StatusesCount), 10, j.StatusesCount < 0)
3744 buf.WriteString(`,"time_zone":`)
3745 fflib.WriteJsonString(buf, string(j.TimeZone))
3746 if j.URL != nil {
3747 buf.WriteString(`,"url":`)
3748 fflib.WriteJsonString(buf, string(*j.URL))
3749 } else {
3750 buf.WriteString(`,"url":null`)
3751 }
3752 buf.WriteString(`,"utc_offset":`)
3753 fflib.FormatBits2(buf, uint64(j.UtcOffset), 10, j.UtcOffset < 0)
3754 if j.Verified {
3755 buf.WriteString(`,"verified":true`)
3756 } else {
3757 buf.WriteString(`,"verified":false`)
3758 }
3759 buf.WriteByte('}')
3760 return nil
3761 }
3762
3763 const (
3764 ffjtUserbase = iota
3765 ffjtUsernosuchkey
3766
3767 ffjtUserContributorsEnabled
3768
3769 ffjtUserCreatedAt
3770
3771 ffjtUserDefaultProfile
3772
3773 ffjtUserDefaultProfileImage
3774
3775 ffjtUserDescription
3776
3777 ffjtUserEntities
3778
3779 ffjtUserFavouritesCount
3780
3781 ffjtUserFollowRequestSent
3782
3783 ffjtUserFollowersCount
3784
3785 ffjtUserFollowing
3786
3787 ffjtUserFriendsCount
3788
3789 ffjtUserGeoEnabled
3790
3791 ffjtUserID
3792
3793 ffjtUserIDStr
3794
3795 ffjtUserIsTranslator
3796
3797 ffjtUserLang
3798
3799 ffjtUserListedCount
3800
3801 ffjtUserLocation
3802
3803 ffjtUserName
3804
3805 ffjtUserNotifications
3806
3807 ffjtUserProfileBackgroundColor
3808
3809 ffjtUserProfileBackgroundImageURL
3810
3811 ffjtUserProfileBackgroundImageURLHTTPS
3812
3813 ffjtUserProfileBackgroundTile
3814
3815 ffjtUserProfileImageURL
3816
3817 ffjtUserProfileImageURLHTTPS
3818
3819 ffjtUserProfileLinkColor
3820
3821 ffjtUserProfileSidebarBorderColor
3822
3823 ffjtUserProfileSidebarFillColor
3824
3825 ffjtUserProfileTextColor
3826
3827 ffjtUserProfileUseBackgroundImage
3828
3829 ffjtUserProtected
3830
3831 ffjtUserScreenName
3832
3833 ffjtUserShowAllInlineMedia
3834
3835 ffjtUserStatusesCount
3836
3837 ffjtUserTimeZone
3838
3839 ffjtUserURL
3840
3841 ffjtUserUtcOffset
3842
3843 ffjtUserVerified
3844 )
3845
3846 var ffjKeyUserContributorsEnabled = []byte("contributors_enabled")
3847
3848 var ffjKeyUserCreatedAt = []byte("created_at")
3849
3850 var ffjKeyUserDefaultProfile = []byte("default_profile")
3851
3852 var ffjKeyUserDefaultProfileImage = []byte("default_profile_image")
3853
3854 var ffjKeyUserDescription = []byte("description")
3855
3856 var ffjKeyUserEntities = []byte("entities")
3857
3858 var ffjKeyUserFavouritesCount = []byte("favourites_count")
3859
3860 var ffjKeyUserFollowRequestSent = []byte("follow_request_sent")
3861
3862 var ffjKeyUserFollowersCount = []byte("followers_count")
3863
3864 var ffjKeyUserFollowing = []byte("following")
3865
3866 var ffjKeyUserFriendsCount = []byte("friends_count")
3867
3868 var ffjKeyUserGeoEnabled = []byte("geo_enabled")
3869
3870 var ffjKeyUserID = []byte("id")
3871
3872 var ffjKeyUserIDStr = []byte("id_str")
3873
3874 var ffjKeyUserIsTranslator = []byte("is_translator")
3875
3876 var ffjKeyUserLang = []byte("lang")
3877
3878 var ffjKeyUserListedCount = []byte("listed_count")
3879
3880 var ffjKeyUserLocation = []byte("location")
3881
3882 var ffjKeyUserName = []byte("name")
3883
3884 var ffjKeyUserNotifications = []byte("notifications")
3885
3886 var ffjKeyUserProfileBackgroundColor = []byte("profile_background_color")
3887
3888 var ffjKeyUserProfileBackgroundImageURL = []byte("profile_background_image_url")
3889
3890 var ffjKeyUserProfileBackgroundImageURLHTTPS = []byte("profile_background_image_url_https")
3891
3892 var ffjKeyUserProfileBackgroundTile = []byte("profile_background_tile")
3893
3894 var ffjKeyUserProfileImageURL = []byte("profile_image_url")
3895
3896 var ffjKeyUserProfileImageURLHTTPS = []byte("profile_image_url_https")
3897
3898 var ffjKeyUserProfileLinkColor = []byte("profile_link_color")
3899
3900 var ffjKeyUserProfileSidebarBorderColor = []byte("profile_sidebar_border_color")
3901
3902 var ffjKeyUserProfileSidebarFillColor = []byte("profile_sidebar_fill_color")
3903
3904 var ffjKeyUserProfileTextColor = []byte("profile_text_color")
3905
3906 var ffjKeyUserProfileUseBackgroundImage = []byte("profile_use_background_image")
3907
3908 var ffjKeyUserProtected = []byte("protected")
3909
3910 var ffjKeyUserScreenName = []byte("screen_name")
3911
3912 var ffjKeyUserShowAllInlineMedia = []byte("show_all_inline_media")
3913
3914 var ffjKeyUserStatusesCount = []byte("statuses_count")
3915
3916 var ffjKeyUserTimeZone = []byte("time_zone")
3917
3918 var ffjKeyUserURL = []byte("url")
3919
3920 var ffjKeyUserUtcOffset = []byte("utc_offset")
3921
3922 var ffjKeyUserVerified = []byte("verified")
3923
3924 // UnmarshalJSON umarshall json - template of ffjson
3925 func (j *User) UnmarshalJSON(input []byte) error {
3926 fs := fflib.NewFFLexer(input)
3927 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
3928 }
3929
3930 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
3931 func (j *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
3932 var err error
3933 currentKey := ffjtUserbase
3934 _ = currentKey
3935 tok := fflib.FFTok_init
3936 wantedTok := fflib.FFTok_init
3937
3938 mainparse:
3939 for {
3940 tok = fs.Scan()
3941 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
3942 if tok == fflib.FFTok_error {
3943 goto tokerror
3944 }
3945
3946 switch state {
3947
3948 case fflib.FFParse_map_start:
3949 if tok != fflib.FFTok_left_bracket {
3950 wantedTok = fflib.FFTok_left_bracket
3951 goto wrongtokenerror
3952 }
3953 state = fflib.FFParse_want_key
3954 continue
3955
3956 case fflib.FFParse_after_value:
3957 if tok == fflib.FFTok_comma {
3958 state = fflib.FFParse_want_key
3959 } else if tok == fflib.FFTok_right_bracket {
3960 goto done
3961 } else {
3962 wantedTok = fflib.FFTok_comma
3963 goto wrongtokenerror
3964 }
3965
3966 case fflib.FFParse_want_key:
3967 // json {} ended. goto exit. woo.
3968 if tok == fflib.FFTok_right_bracket {
3969 goto done
3970 }
3971 if tok != fflib.FFTok_string {
3972 wantedTok = fflib.FFTok_string
3973 goto wrongtokenerror
3974 }
3975
3976 kn := fs.Output.Bytes()
3977 if len(kn) <= 0 {
3978 // "" case. hrm.
3979 currentKey = ffjtUsernosuchkey
3980 state = fflib.FFParse_want_colon
3981 goto mainparse
3982 } else {
3983 switch kn[0] {
3984
3985 case 'c':
3986
3987 if bytes.Equal(ffjKeyUserContributorsEnabled, kn) {
3988 currentKey = ffjtUserContributorsEnabled
3989 state = fflib.FFParse_want_colon
3990 goto mainparse
3991
3992 } else if bytes.Equal(ffjKeyUserCreatedAt, kn) {
3993 currentKey = ffjtUserCreatedAt
3994 state = fflib.FFParse_want_colon
3995 goto mainparse
3996 }
3997
3998 case 'd':
3999
4000 if bytes.Equal(ffjKeyUserDefaultProfile, kn) {
4001 currentKey = ffjtUserDefaultProfile
4002 state = fflib.FFParse_want_colon
4003 goto mainparse
4004
4005 } else if bytes.Equal(ffjKeyUserDefaultProfileImage, kn) {
4006 currentKey = ffjtUserDefaultProfileImage
4007 state = fflib.FFParse_want_colon
4008 goto mainparse
4009
4010 } else if bytes.Equal(ffjKeyUserDescription, kn) {
4011 currentKey = ffjtUserDescription
4012 state = fflib.FFParse_want_colon
4013 goto mainparse
4014 }
4015
4016 case 'e':
4017
4018 if bytes.Equal(ffjKeyUserEntities, kn) {
4019 currentKey = ffjtUserEntities
4020 state = fflib.FFParse_want_colon
4021 goto mainparse
4022 }
4023
4024 case 'f':
4025
4026 if bytes.Equal(ffjKeyUserFavouritesCount, kn) {
4027 currentKey = ffjtUserFavouritesCount
4028 state = fflib.FFParse_want_colon
4029 goto mainparse
4030
4031 } else if bytes.Equal(ffjKeyUserFollowRequestSent, kn) {
4032 currentKey = ffjtUserFollowRequestSent
4033 state = fflib.FFParse_want_colon
4034 goto mainparse
4035
4036 } else if bytes.Equal(ffjKeyUserFollowersCount, kn) {
4037 currentKey = ffjtUserFollowersCount
4038 state = fflib.FFParse_want_colon
4039 goto mainparse
4040
4041 } else if bytes.Equal(ffjKeyUserFollowing, kn) {
4042 currentKey = ffjtUserFollowing
4043 state = fflib.FFParse_want_colon
4044 goto mainparse
4045
4046 } else if bytes.Equal(ffjKeyUserFriendsCount, kn) {
4047 currentKey = ffjtUserFriendsCount
4048 state = fflib.FFParse_want_colon
4049 goto mainparse
4050 }
4051
4052 case 'g':
4053
4054 if bytes.Equal(ffjKeyUserGeoEnabled, kn) {
4055 currentKey = ffjtUserGeoEnabled
4056 state = fflib.FFParse_want_colon
4057 goto mainparse
4058 }
4059
4060 case 'i':
4061
4062 if bytes.Equal(ffjKeyUserID, kn) {
4063 currentKey = ffjtUserID
4064 state = fflib.FFParse_want_colon
4065 goto mainparse
4066
4067 } else if bytes.Equal(ffjKeyUserIDStr, kn) {
4068 currentKey = ffjtUserIDStr
4069 state = fflib.FFParse_want_colon
4070 goto mainparse
4071
4072 } else if bytes.Equal(ffjKeyUserIsTranslator, kn) {
4073 currentKey = ffjtUserIsTranslator
4074 state = fflib.FFParse_want_colon
4075 goto mainparse
4076 }
4077
4078 case 'l':
4079
4080 if bytes.Equal(ffjKeyUserLang, kn) {
4081 currentKey = ffjtUserLang
4082 state = fflib.FFParse_want_colon
4083 goto mainparse
4084
4085 } else if bytes.Equal(ffjKeyUserListedCount, kn) {
4086 currentKey = ffjtUserListedCount
4087 state = fflib.FFParse_want_colon
4088 goto mainparse
4089
4090 } else if bytes.Equal(ffjKeyUserLocation, kn) {
4091 currentKey = ffjtUserLocation
4092 state = fflib.FFParse_want_colon
4093 goto mainparse
4094 }
4095
4096 case 'n':
4097
4098 if bytes.Equal(ffjKeyUserName, kn) {
4099 currentKey = ffjtUserName
4100 state = fflib.FFParse_want_colon
4101 goto mainparse
4102
4103 } else if bytes.Equal(ffjKeyUserNotifications, kn) {
4104 currentKey = ffjtUserNotifications
4105 state = fflib.FFParse_want_colon
4106 goto mainparse
4107 }
4108
4109 case 'p':
4110
4111 if bytes.Equal(ffjKeyUserProfileBackgroundColor, kn) {
4112 currentKey = ffjtUserProfileBackgroundColor
4113 state = fflib.FFParse_want_colon
4114 goto mainparse
4115
4116 } else if bytes.Equal(ffjKeyUserProfileBackgroundImageURL, kn) {
4117 currentKey = ffjtUserProfileBackgroundImageURL
4118 state = fflib.FFParse_want_colon
4119 goto mainparse
4120
4121 } else if bytes.Equal(ffjKeyUserProfileBackgroundImageURLHTTPS, kn) {
4122 currentKey = ffjtUserProfileBackgroundImageURLHTTPS
4123 state = fflib.FFParse_want_colon
4124 goto mainparse
4125
4126 } else if bytes.Equal(ffjKeyUserProfileBackgroundTile, kn) {
4127 currentKey = ffjtUserProfileBackgroundTile
4128 state = fflib.FFParse_want_colon
4129 goto mainparse
4130
4131 } else if bytes.Equal(ffjKeyUserProfileImageURL, kn) {
4132 currentKey = ffjtUserProfileImageURL
4133 state = fflib.FFParse_want_colon
4134 goto mainparse
4135
4136 } else if bytes.Equal(ffjKeyUserProfileImageURLHTTPS, kn) {
4137 currentKey = ffjtUserProfileImageURLHTTPS
4138 state = fflib.FFParse_want_colon
4139 goto mainparse
4140
4141 } else if bytes.Equal(ffjKeyUserProfileLinkColor, kn) {
4142 currentKey = ffjtUserProfileLinkColor
4143 state = fflib.FFParse_want_colon
4144 goto mainparse
4145
4146 } else if bytes.Equal(ffjKeyUserProfileSidebarBorderColor, kn) {
4147 currentKey = ffjtUserProfileSidebarBorderColor
4148 state = fflib.FFParse_want_colon
4149 goto mainparse
4150
4151 } else if bytes.Equal(ffjKeyUserProfileSidebarFillColor, kn) {
4152 currentKey = ffjtUserProfileSidebarFillColor
4153 state = fflib.FFParse_want_colon
4154 goto mainparse
4155
4156 } else if bytes.Equal(ffjKeyUserProfileTextColor, kn) {
4157 currentKey = ffjtUserProfileTextColor
4158 state = fflib.FFParse_want_colon
4159 goto mainparse
4160
4161 } else if bytes.Equal(ffjKeyUserProfileUseBackgroundImage, kn) {
4162 currentKey = ffjtUserProfileUseBackgroundImage
4163 state = fflib.FFParse_want_colon
4164 goto mainparse
4165
4166 } else if bytes.Equal(ffjKeyUserProtected, kn) {
4167 currentKey = ffjtUserProtected
4168 state = fflib.FFParse_want_colon
4169 goto mainparse
4170 }
4171
4172 case 's':
4173
4174 if bytes.Equal(ffjKeyUserScreenName, kn) {
4175 currentKey = ffjtUserScreenName
4176 state = fflib.FFParse_want_colon
4177 goto mainparse
4178
4179 } else if bytes.Equal(ffjKeyUserShowAllInlineMedia, kn) {
4180 currentKey = ffjtUserShowAllInlineMedia
4181 state = fflib.FFParse_want_colon
4182 goto mainparse
4183
4184 } else if bytes.Equal(ffjKeyUserStatusesCount, kn) {
4185 currentKey = ffjtUserStatusesCount
4186 state = fflib.FFParse_want_colon
4187 goto mainparse
4188 }
4189
4190 case 't':
4191
4192 if bytes.Equal(ffjKeyUserTimeZone, kn) {
4193 currentKey = ffjtUserTimeZone
4194 state = fflib.FFParse_want_colon
4195 goto mainparse
4196 }
4197
4198 case 'u':
4199
4200 if bytes.Equal(ffjKeyUserURL, kn) {
4201 currentKey = ffjtUserURL
4202 state = fflib.FFParse_want_colon
4203 goto mainparse
4204
4205 } else if bytes.Equal(ffjKeyUserUtcOffset, kn) {
4206 currentKey = ffjtUserUtcOffset
4207 state = fflib.FFParse_want_colon
4208 goto mainparse
4209 }
4210
4211 case 'v':
4212
4213 if bytes.Equal(ffjKeyUserVerified, kn) {
4214 currentKey = ffjtUserVerified
4215 state = fflib.FFParse_want_colon
4216 goto mainparse
4217 }
4218
4219 }
4220
4221 if fflib.SimpleLetterEqualFold(ffjKeyUserVerified, kn) {
4222 currentKey = ffjtUserVerified
4223 state = fflib.FFParse_want_colon
4224 goto mainparse
4225 }
4226
4227 if fflib.EqualFoldRight(ffjKeyUserUtcOffset, kn) {
4228 currentKey = ffjtUserUtcOffset
4229 state = fflib.FFParse_want_colon
4230 goto mainparse
4231 }
4232
4233 if fflib.SimpleLetterEqualFold(ffjKeyUserURL, kn) {
4234 currentKey = ffjtUserURL
4235 state = fflib.FFParse_want_colon
4236 goto mainparse
4237 }
4238
4239 if fflib.AsciiEqualFold(ffjKeyUserTimeZone, kn) {
4240 currentKey = ffjtUserTimeZone
4241 state = fflib.FFParse_want_colon
4242 goto mainparse
4243 }
4244
4245 if fflib.EqualFoldRight(ffjKeyUserStatusesCount, kn) {
4246 currentKey = ffjtUserStatusesCount
4247 state = fflib.FFParse_want_colon
4248 goto mainparse
4249 }
4250
4251 if fflib.EqualFoldRight(ffjKeyUserShowAllInlineMedia, kn) {
4252 currentKey = ffjtUserShowAllInlineMedia
4253 state = fflib.FFParse_want_colon
4254 goto mainparse
4255 }
4256
4257 if fflib.EqualFoldRight(ffjKeyUserScreenName, kn) {
4258 currentKey = ffjtUserScreenName
4259 state = fflib.FFParse_want_colon
4260 goto mainparse
4261 }
4262
4263 if fflib.SimpleLetterEqualFold(ffjKeyUserProtected, kn) {
4264 currentKey = ffjtUserProtected
4265 state = fflib.FFParse_want_colon
4266 goto mainparse
4267 }
4268
4269 if fflib.EqualFoldRight(ffjKeyUserProfileUseBackgroundImage, kn) {
4270 currentKey = ffjtUserProfileUseBackgroundImage
4271 state = fflib.FFParse_want_colon
4272 goto mainparse
4273 }
4274
4275 if fflib.AsciiEqualFold(ffjKeyUserProfileTextColor, kn) {
4276 currentKey = ffjtUserProfileTextColor
4277 state = fflib.FFParse_want_colon
4278 goto mainparse
4279 }
4280
4281 if fflib.EqualFoldRight(ffjKeyUserProfileSidebarFillColor, kn) {
4282 currentKey = ffjtUserProfileSidebarFillColor
4283 state = fflib.FFParse_want_colon
4284 goto mainparse
4285 }
4286
4287 if fflib.EqualFoldRight(ffjKeyUserProfileSidebarBorderColor, kn) {
4288 currentKey = ffjtUserProfileSidebarBorderColor
4289 state = fflib.FFParse_want_colon
4290 goto mainparse
4291 }
4292
4293 if fflib.EqualFoldRight(ffjKeyUserProfileLinkColor, kn) {
4294 currentKey = ffjtUserProfileLinkColor
4295 state = fflib.FFParse_want_colon
4296 goto mainparse
4297 }
4298
4299 if fflib.EqualFoldRight(ffjKeyUserProfileImageURLHTTPS, kn) {
4300 currentKey = ffjtUserProfileImageURLHTTPS
4301 state = fflib.FFParse_want_colon
4302 goto mainparse
4303 }
4304
4305 if fflib.AsciiEqualFold(ffjKeyUserProfileImageURL, kn) {
4306 currentKey = ffjtUserProfileImageURL
4307 state = fflib.FFParse_want_colon
4308 goto mainparse
4309 }
4310
4311 if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundTile, kn) {
4312 currentKey = ffjtUserProfileBackgroundTile
4313 state = fflib.FFParse_want_colon
4314 goto mainparse
4315 }
4316
4317 if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundImageURLHTTPS, kn) {
4318 currentKey = ffjtUserProfileBackgroundImageURLHTTPS
4319 state = fflib.FFParse_want_colon
4320 goto mainparse
4321 }
4322
4323 if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundImageURL, kn) {
4324 currentKey = ffjtUserProfileBackgroundImageURL
4325 state = fflib.FFParse_want_colon
4326 goto mainparse
4327 }
4328
4329 if fflib.EqualFoldRight(ffjKeyUserProfileBackgroundColor, kn) {
4330 currentKey = ffjtUserProfileBackgroundColor
4331 state = fflib.FFParse_want_colon
4332 goto mainparse
4333 }
4334
4335 if fflib.EqualFoldRight(ffjKeyUserNotifications, kn) {
4336 currentKey = ffjtUserNotifications
4337 state = fflib.FFParse_want_colon
4338 goto mainparse
4339 }
4340
4341 if fflib.SimpleLetterEqualFold(ffjKeyUserName, kn) {
4342 currentKey = ffjtUserName
4343 state = fflib.FFParse_want_colon
4344 goto mainparse
4345 }
4346
4347 if fflib.SimpleLetterEqualFold(ffjKeyUserLocation, kn) {
4348 currentKey = ffjtUserLocation
4349 state = fflib.FFParse_want_colon
4350 goto mainparse
4351 }
4352
4353 if fflib.EqualFoldRight(ffjKeyUserListedCount, kn) {
4354 currentKey = ffjtUserListedCount
4355 state = fflib.FFParse_want_colon
4356 goto mainparse
4357 }
4358
4359 if fflib.SimpleLetterEqualFold(ffjKeyUserLang, kn) {
4360 currentKey = ffjtUserLang
4361 state = fflib.FFParse_want_colon
4362 goto mainparse
4363 }
4364
4365 if fflib.EqualFoldRight(ffjKeyUserIsTranslator, kn) {
4366 currentKey = ffjtUserIsTranslator
4367 state = fflib.FFParse_want_colon
4368 goto mainparse
4369 }
4370
4371 if fflib.EqualFoldRight(ffjKeyUserIDStr, kn) {
4372 currentKey = ffjtUserIDStr
4373 state = fflib.FFParse_want_colon
4374 goto mainparse
4375 }
4376
4377 if fflib.SimpleLetterEqualFold(ffjKeyUserID, kn) {
4378 currentKey = ffjtUserID
4379 state = fflib.FFParse_want_colon
4380 goto mainparse
4381 }
4382
4383 if fflib.AsciiEqualFold(ffjKeyUserGeoEnabled, kn) {
4384 currentKey = ffjtUserGeoEnabled
4385 state = fflib.FFParse_want_colon
4386 goto mainparse
4387 }
4388
4389 if fflib.EqualFoldRight(ffjKeyUserFriendsCount, kn) {
4390 currentKey = ffjtUserFriendsCount
4391 state = fflib.FFParse_want_colon
4392 goto mainparse
4393 }
4394
4395 if fflib.SimpleLetterEqualFold(ffjKeyUserFollowing, kn) {
4396 currentKey = ffjtUserFollowing
4397 state = fflib.FFParse_want_colon
4398 goto mainparse
4399 }
4400
4401 if fflib.EqualFoldRight(ffjKeyUserFollowersCount, kn) {
4402 currentKey = ffjtUserFollowersCount
4403 state = fflib.FFParse_want_colon
4404 goto mainparse
4405 }
4406
4407 if fflib.EqualFoldRight(ffjKeyUserFollowRequestSent, kn) {
4408 currentKey = ffjtUserFollowRequestSent
4409 state = fflib.FFParse_want_colon
4410 goto mainparse
4411 }
4412
4413 if fflib.EqualFoldRight(ffjKeyUserFavouritesCount, kn) {
4414 currentKey = ffjtUserFavouritesCount
4415 state = fflib.FFParse_want_colon
4416 goto mainparse
4417 }
4418
4419 if fflib.EqualFoldRight(ffjKeyUserEntities, kn) {
4420 currentKey = ffjtUserEntities
4421 state = fflib.FFParse_want_colon
4422 goto mainparse
4423 }
4424
4425 if fflib.EqualFoldRight(ffjKeyUserDescription, kn) {
4426 currentKey = ffjtUserDescription
4427 state = fflib.FFParse_want_colon
4428 goto mainparse
4429 }
4430
4431 if fflib.AsciiEqualFold(ffjKeyUserDefaultProfileImage, kn) {
4432 currentKey = ffjtUserDefaultProfileImage
4433 state = fflib.FFParse_want_colon
4434 goto mainparse
4435 }
4436
4437 if fflib.AsciiEqualFold(ffjKeyUserDefaultProfile, kn) {
4438 currentKey = ffjtUserDefaultProfile
4439 state = fflib.FFParse_want_colon
4440 goto mainparse
4441 }
4442
4443 if fflib.AsciiEqualFold(ffjKeyUserCreatedAt, kn) {
4444 currentKey = ffjtUserCreatedAt
4445 state = fflib.FFParse_want_colon
4446 goto mainparse
4447 }
4448
4449 if fflib.EqualFoldRight(ffjKeyUserContributorsEnabled, kn) {
4450 currentKey = ffjtUserContributorsEnabled
4451 state = fflib.FFParse_want_colon
4452 goto mainparse
4453 }
4454
4455 currentKey = ffjtUsernosuchkey
4456 state = fflib.FFParse_want_colon
4457 goto mainparse
4458 }
4459
4460 case fflib.FFParse_want_colon:
4461 if tok != fflib.FFTok_colon {
4462 wantedTok = fflib.FFTok_colon
4463 goto wrongtokenerror
4464 }
4465 state = fflib.FFParse_want_value
4466 continue
4467 case fflib.FFParse_want_value:
4468
4469 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
4470 switch currentKey {
4471
4472 case ffjtUserContributorsEnabled:
4473 goto handle_ContributorsEnabled
4474
4475 case ffjtUserCreatedAt:
4476 goto handle_CreatedAt
4477
4478 case ffjtUserDefaultProfile:
4479 goto handle_DefaultProfile
4480
4481 case ffjtUserDefaultProfileImage:
4482 goto handle_DefaultProfileImage
4483
4484 case ffjtUserDescription:
4485 goto handle_Description
4486
4487 case ffjtUserEntities:
4488 goto handle_Entities
4489
4490 case ffjtUserFavouritesCount:
4491 goto handle_FavouritesCount
4492
4493 case ffjtUserFollowRequestSent:
4494 goto handle_FollowRequestSent
4495
4496 case ffjtUserFollowersCount:
4497 goto handle_FollowersCount
4498
4499 case ffjtUserFollowing:
4500 goto handle_Following
4501
4502 case ffjtUserFriendsCount:
4503 goto handle_FriendsCount
4504
4505 case ffjtUserGeoEnabled:
4506 goto handle_GeoEnabled
4507
4508 case ffjtUserID:
4509 goto handle_ID
4510
4511 case ffjtUserIDStr:
4512 goto handle_IDStr
4513
4514 case ffjtUserIsTranslator:
4515 goto handle_IsTranslator
4516
4517 case ffjtUserLang:
4518 goto handle_Lang
4519
4520 case ffjtUserListedCount:
4521 goto handle_ListedCount
4522
4523 case ffjtUserLocation:
4524 goto handle_Location
4525
4526 case ffjtUserName:
4527 goto handle_Name
4528
4529 case ffjtUserNotifications:
4530 goto handle_Notifications
4531
4532 case ffjtUserProfileBackgroundColor:
4533 goto handle_ProfileBackgroundColor
4534
4535 case ffjtUserProfileBackgroundImageURL:
4536 goto handle_ProfileBackgroundImageURL
4537
4538 case ffjtUserProfileBackgroundImageURLHTTPS:
4539 goto handle_ProfileBackgroundImageURLHTTPS
4540
4541 case ffjtUserProfileBackgroundTile:
4542 goto handle_ProfileBackgroundTile
4543
4544 case ffjtUserProfileImageURL:
4545 goto handle_ProfileImageURL
4546
4547 case ffjtUserProfileImageURLHTTPS:
4548 goto handle_ProfileImageURLHTTPS
4549
4550 case ffjtUserProfileLinkColor:
4551 goto handle_ProfileLinkColor
4552
4553 case ffjtUserProfileSidebarBorderColor:
4554 goto handle_ProfileSidebarBorderColor
4555
4556 case ffjtUserProfileSidebarFillColor:
4557 goto handle_ProfileSidebarFillColor
4558
4559 case ffjtUserProfileTextColor:
4560 goto handle_ProfileTextColor
4561
4562 case ffjtUserProfileUseBackgroundImage:
4563 goto handle_ProfileUseBackgroundImage
4564
4565 case ffjtUserProtected:
4566 goto handle_Protected
4567
4568 case ffjtUserScreenName:
4569 goto handle_ScreenName
4570
4571 case ffjtUserShowAllInlineMedia:
4572 goto handle_ShowAllInlineMedia
4573
4574 case ffjtUserStatusesCount:
4575 goto handle_StatusesCount
4576
4577 case ffjtUserTimeZone:
4578 goto handle_TimeZone
4579
4580 case ffjtUserURL:
4581 goto handle_URL
4582
4583 case ffjtUserUtcOffset:
4584 goto handle_UtcOffset
4585
4586 case ffjtUserVerified:
4587 goto handle_Verified
4588
4589 case ffjtUsernosuchkey:
4590 err = fs.SkipField(tok)
4591 if err != nil {
4592 return fs.WrapErr(err)
4593 }
4594 state = fflib.FFParse_after_value
4595 goto mainparse
4596 }
4597 } else {
4598 goto wantedvalue
4599 }
4600 }
4601 }
4602
4603 handle_ContributorsEnabled:
4604
4605 /* handler: j.ContributorsEnabled type=bool kind=bool quoted=false*/
4606
4607 {
4608 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
4609 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
4610 }
4611 }
4612
4613 {
4614 if tok == fflib.FFTok_null {
4615
4616 } else {
4617 tmpb := fs.Output.Bytes()
4618
4619 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
4620
4621 j.ContributorsEnabled = true
4622
4623 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
4624
4625 j.ContributorsEnabled = false
4626
4627 } else {
4628 err = errors.New("unexpected bytes for true/false value")
4629 return fs.WrapErr(err)
4630 }
4631
4632 }
4633 }
4634
4635 state = fflib.FFParse_after_value
4636 goto mainparse
4637
4638 handle_CreatedAt:
4639
4640 /* handler: j.CreatedAt type=string kind=string quoted=false*/
4641
4642 {
4643
4644 {
4645 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
4646 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
4647 }
4648 }
4649
4650 if tok == fflib.FFTok_null {
4651
4652 } else {
4653
4654 outBuf := fs.Output.Bytes()
4655
4656 j.CreatedAt = string(string(outBuf))
4657
4658 }
4659 }
4660
4661 state = fflib.FFParse_after_value
4662 goto mainparse
4663
4664 handle_DefaultProfile:
4665
4666 /* handler: j.DefaultProfile type=bool kind=bool quoted=false*/
4667
4668 {
4669 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
4670 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
4671 }
4672 }
4673
4674 {
4675 if tok == fflib.FFTok_null {
4676
4677 } else {
4678 tmpb := fs.Output.Bytes()
4679
4680 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
4681
4682 j.DefaultProfile = true
4683
4684 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
4685
4686 j.DefaultProfile = false
4687
4688 } else {
4689 err = errors.New("unexpected bytes for true/false value")
4690 return fs.WrapErr(err)
4691 }
4692
4693 }
4694 }
4695
4696 state = fflib.FFParse_after_value
4697 goto mainparse
4698
4699 handle_DefaultProfileImage:
4700
4701 /* handler: j.DefaultProfileImage type=bool kind=bool quoted=false*/
4702
4703 {
4704 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
4705 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
4706 }
4707 }
4708
4709 {
4710 if tok == fflib.FFTok_null {
4711
4712 } else {
4713 tmpb := fs.Output.Bytes()
4714
4715 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
4716
4717 j.DefaultProfileImage = true
4718
4719 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
4720
4721 j.DefaultProfileImage = false
4722
4723 } else {
4724 err = errors.New("unexpected bytes for true/false value")
4725 return fs.WrapErr(err)
4726 }
4727
4728 }
4729 }
4730
4731 state = fflib.FFParse_after_value
4732 goto mainparse
4733
4734 handle_Description:
4735
4736 /* handler: j.Description type=string kind=string quoted=false*/
4737
4738 {
4739
4740 {
4741 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
4742 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
4743 }
4744 }
4745
4746 if tok == fflib.FFTok_null {
4747
4748 } else {
4749
4750 outBuf := fs.Output.Bytes()
4751
4752 j.Description = string(string(outBuf))
4753
4754 }
4755 }
4756
4757 state = fflib.FFParse_after_value
4758 goto mainparse
4759
4760 handle_Entities:
4761
4762 /* handler: j.Entities type=benchmark.UserEntities kind=struct quoted=false*/
4763
4764 {
4765 if tok == fflib.FFTok_null {
4766
4767 } else {
4768
4769 err = j.Entities.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
4770 if err != nil {
4771 return err
4772 }
4773 }
4774 state = fflib.FFParse_after_value
4775 }
4776
4777 state = fflib.FFParse_after_value
4778 goto mainparse
4779
4780 handle_FavouritesCount:
4781
4782 /* handler: j.FavouritesCount type=int kind=int quoted=false*/
4783
4784 {
4785 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
4786 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
4787 }
4788 }
4789
4790 {
4791
4792 if tok == fflib.FFTok_null {
4793
4794 } else {
4795
4796 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
4797
4798 if err != nil {
4799 return fs.WrapErr(err)
4800 }
4801
4802 j.FavouritesCount = int(tval)
4803
4804 }
4805 }
4806
4807 state = fflib.FFParse_after_value
4808 goto mainparse
4809
4810 handle_FollowRequestSent:
4811
4812 /* handler: j.FollowRequestSent type=string kind=string quoted=false*/
4813
4814 {
4815
4816 {
4817 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
4818 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
4819 }
4820 }
4821
4822 if tok == fflib.FFTok_null {
4823
4824 j.FollowRequestSent = nil
4825
4826 } else {
4827
4828 var tval string
4829 outBuf := fs.Output.Bytes()
4830
4831 tval = string(string(outBuf))
4832 j.FollowRequestSent = &tval
4833
4834 }
4835 }
4836
4837 state = fflib.FFParse_after_value
4838 goto mainparse
4839
4840 handle_FollowersCount:
4841
4842 /* handler: j.FollowersCount type=int kind=int quoted=false*/
4843
4844 {
4845 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
4846 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
4847 }
4848 }
4849
4850 {
4851
4852 if tok == fflib.FFTok_null {
4853
4854 } else {
4855
4856 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
4857
4858 if err != nil {
4859 return fs.WrapErr(err)
4860 }
4861
4862 j.FollowersCount = int(tval)
4863
4864 }
4865 }
4866
4867 state = fflib.FFParse_after_value
4868 goto mainparse
4869
4870 handle_Following:
4871
4872 /* handler: j.Following type=string kind=string quoted=false*/
4873
4874 {
4875
4876 {
4877 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
4878 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
4879 }
4880 }
4881
4882 if tok == fflib.FFTok_null {
4883
4884 j.Following = nil
4885
4886 } else {
4887
4888 var tval string
4889 outBuf := fs.Output.Bytes()
4890
4891 tval = string(string(outBuf))
4892 j.Following = &tval
4893
4894 }
4895 }
4896
4897 state = fflib.FFParse_after_value
4898 goto mainparse
4899
4900 handle_FriendsCount:
4901
4902 /* handler: j.FriendsCount type=int kind=int quoted=false*/
4903
4904 {
4905 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
4906 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
4907 }
4908 }
4909
4910 {
4911
4912 if tok == fflib.FFTok_null {
4913
4914 } else {
4915
4916 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
4917
4918 if err != nil {
4919 return fs.WrapErr(err)
4920 }
4921
4922 j.FriendsCount = int(tval)
4923
4924 }
4925 }
4926
4927 state = fflib.FFParse_after_value
4928 goto mainparse
4929
4930 handle_GeoEnabled:
4931
4932 /* handler: j.GeoEnabled type=bool kind=bool quoted=false*/
4933
4934 {
4935 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
4936 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
4937 }
4938 }
4939
4940 {
4941 if tok == fflib.FFTok_null {
4942
4943 } else {
4944 tmpb := fs.Output.Bytes()
4945
4946 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
4947
4948 j.GeoEnabled = true
4949
4950 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
4951
4952 j.GeoEnabled = false
4953
4954 } else {
4955 err = errors.New("unexpected bytes for true/false value")
4956 return fs.WrapErr(err)
4957 }
4958
4959 }
4960 }
4961
4962 state = fflib.FFParse_after_value
4963 goto mainparse
4964
4965 handle_ID:
4966
4967 /* handler: j.ID type=int kind=int quoted=false*/
4968
4969 {
4970 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
4971 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
4972 }
4973 }
4974
4975 {
4976
4977 if tok == fflib.FFTok_null {
4978
4979 } else {
4980
4981 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
4982
4983 if err != nil {
4984 return fs.WrapErr(err)
4985 }
4986
4987 j.ID = int(tval)
4988
4989 }
4990 }
4991
4992 state = fflib.FFParse_after_value
4993 goto mainparse
4994
4995 handle_IDStr:
4996
4997 /* handler: j.IDStr type=string kind=string quoted=false*/
4998
4999 {
5000
5001 {
5002 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5003 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5004 }
5005 }
5006
5007 if tok == fflib.FFTok_null {
5008
5009 } else {
5010
5011 outBuf := fs.Output.Bytes()
5012
5013 j.IDStr = string(string(outBuf))
5014
5015 }
5016 }
5017
5018 state = fflib.FFParse_after_value
5019 goto mainparse
5020
5021 handle_IsTranslator:
5022
5023 /* handler: j.IsTranslator type=bool kind=bool quoted=false*/
5024
5025 {
5026 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5027 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5028 }
5029 }
5030
5031 {
5032 if tok == fflib.FFTok_null {
5033
5034 } else {
5035 tmpb := fs.Output.Bytes()
5036
5037 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5038
5039 j.IsTranslator = true
5040
5041 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5042
5043 j.IsTranslator = false
5044
5045 } else {
5046 err = errors.New("unexpected bytes for true/false value")
5047 return fs.WrapErr(err)
5048 }
5049
5050 }
5051 }
5052
5053 state = fflib.FFParse_after_value
5054 goto mainparse
5055
5056 handle_Lang:
5057
5058 /* handler: j.Lang type=string kind=string quoted=false*/
5059
5060 {
5061
5062 {
5063 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5064 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5065 }
5066 }
5067
5068 if tok == fflib.FFTok_null {
5069
5070 } else {
5071
5072 outBuf := fs.Output.Bytes()
5073
5074 j.Lang = string(string(outBuf))
5075
5076 }
5077 }
5078
5079 state = fflib.FFParse_after_value
5080 goto mainparse
5081
5082 handle_ListedCount:
5083
5084 /* handler: j.ListedCount type=int kind=int quoted=false*/
5085
5086 {
5087 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
5088 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
5089 }
5090 }
5091
5092 {
5093
5094 if tok == fflib.FFTok_null {
5095
5096 } else {
5097
5098 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
5099
5100 if err != nil {
5101 return fs.WrapErr(err)
5102 }
5103
5104 j.ListedCount = int(tval)
5105
5106 }
5107 }
5108
5109 state = fflib.FFParse_after_value
5110 goto mainparse
5111
5112 handle_Location:
5113
5114 /* handler: j.Location type=string kind=string quoted=false*/
5115
5116 {
5117
5118 {
5119 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5120 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5121 }
5122 }
5123
5124 if tok == fflib.FFTok_null {
5125
5126 } else {
5127
5128 outBuf := fs.Output.Bytes()
5129
5130 j.Location = string(string(outBuf))
5131
5132 }
5133 }
5134
5135 state = fflib.FFParse_after_value
5136 goto mainparse
5137
5138 handle_Name:
5139
5140 /* handler: j.Name type=string kind=string quoted=false*/
5141
5142 {
5143
5144 {
5145 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5146 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5147 }
5148 }
5149
5150 if tok == fflib.FFTok_null {
5151
5152 } else {
5153
5154 outBuf := fs.Output.Bytes()
5155
5156 j.Name = string(string(outBuf))
5157
5158 }
5159 }
5160
5161 state = fflib.FFParse_after_value
5162 goto mainparse
5163
5164 handle_Notifications:
5165
5166 /* handler: j.Notifications type=string kind=string quoted=false*/
5167
5168 {
5169
5170 {
5171 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5172 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5173 }
5174 }
5175
5176 if tok == fflib.FFTok_null {
5177
5178 j.Notifications = nil
5179
5180 } else {
5181
5182 var tval string
5183 outBuf := fs.Output.Bytes()
5184
5185 tval = string(string(outBuf))
5186 j.Notifications = &tval
5187
5188 }
5189 }
5190
5191 state = fflib.FFParse_after_value
5192 goto mainparse
5193
5194 handle_ProfileBackgroundColor:
5195
5196 /* handler: j.ProfileBackgroundColor type=string kind=string quoted=false*/
5197
5198 {
5199
5200 {
5201 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5202 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5203 }
5204 }
5205
5206 if tok == fflib.FFTok_null {
5207
5208 } else {
5209
5210 outBuf := fs.Output.Bytes()
5211
5212 j.ProfileBackgroundColor = string(string(outBuf))
5213
5214 }
5215 }
5216
5217 state = fflib.FFParse_after_value
5218 goto mainparse
5219
5220 handle_ProfileBackgroundImageURL:
5221
5222 /* handler: j.ProfileBackgroundImageURL type=string kind=string quoted=false*/
5223
5224 {
5225
5226 {
5227 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5228 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5229 }
5230 }
5231
5232 if tok == fflib.FFTok_null {
5233
5234 } else {
5235
5236 outBuf := fs.Output.Bytes()
5237
5238 j.ProfileBackgroundImageURL = string(string(outBuf))
5239
5240 }
5241 }
5242
5243 state = fflib.FFParse_after_value
5244 goto mainparse
5245
5246 handle_ProfileBackgroundImageURLHTTPS:
5247
5248 /* handler: j.ProfileBackgroundImageURLHTTPS type=string kind=string quoted=false*/
5249
5250 {
5251
5252 {
5253 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5254 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5255 }
5256 }
5257
5258 if tok == fflib.FFTok_null {
5259
5260 } else {
5261
5262 outBuf := fs.Output.Bytes()
5263
5264 j.ProfileBackgroundImageURLHTTPS = string(string(outBuf))
5265
5266 }
5267 }
5268
5269 state = fflib.FFParse_after_value
5270 goto mainparse
5271
5272 handle_ProfileBackgroundTile:
5273
5274 /* handler: j.ProfileBackgroundTile type=bool kind=bool quoted=false*/
5275
5276 {
5277 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5278 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5279 }
5280 }
5281
5282 {
5283 if tok == fflib.FFTok_null {
5284
5285 } else {
5286 tmpb := fs.Output.Bytes()
5287
5288 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5289
5290 j.ProfileBackgroundTile = true
5291
5292 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5293
5294 j.ProfileBackgroundTile = false
5295
5296 } else {
5297 err = errors.New("unexpected bytes for true/false value")
5298 return fs.WrapErr(err)
5299 }
5300
5301 }
5302 }
5303
5304 state = fflib.FFParse_after_value
5305 goto mainparse
5306
5307 handle_ProfileImageURL:
5308
5309 /* handler: j.ProfileImageURL type=string kind=string quoted=false*/
5310
5311 {
5312
5313 {
5314 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5315 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5316 }
5317 }
5318
5319 if tok == fflib.FFTok_null {
5320
5321 } else {
5322
5323 outBuf := fs.Output.Bytes()
5324
5325 j.ProfileImageURL = string(string(outBuf))
5326
5327 }
5328 }
5329
5330 state = fflib.FFParse_after_value
5331 goto mainparse
5332
5333 handle_ProfileImageURLHTTPS:
5334
5335 /* handler: j.ProfileImageURLHTTPS type=string kind=string quoted=false*/
5336
5337 {
5338
5339 {
5340 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5341 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5342 }
5343 }
5344
5345 if tok == fflib.FFTok_null {
5346
5347 } else {
5348
5349 outBuf := fs.Output.Bytes()
5350
5351 j.ProfileImageURLHTTPS = string(string(outBuf))
5352
5353 }
5354 }
5355
5356 state = fflib.FFParse_after_value
5357 goto mainparse
5358
5359 handle_ProfileLinkColor:
5360
5361 /* handler: j.ProfileLinkColor type=string kind=string quoted=false*/
5362
5363 {
5364
5365 {
5366 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5367 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5368 }
5369 }
5370
5371 if tok == fflib.FFTok_null {
5372
5373 } else {
5374
5375 outBuf := fs.Output.Bytes()
5376
5377 j.ProfileLinkColor = string(string(outBuf))
5378
5379 }
5380 }
5381
5382 state = fflib.FFParse_after_value
5383 goto mainparse
5384
5385 handle_ProfileSidebarBorderColor:
5386
5387 /* handler: j.ProfileSidebarBorderColor type=string kind=string quoted=false*/
5388
5389 {
5390
5391 {
5392 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5393 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5394 }
5395 }
5396
5397 if tok == fflib.FFTok_null {
5398
5399 } else {
5400
5401 outBuf := fs.Output.Bytes()
5402
5403 j.ProfileSidebarBorderColor = string(string(outBuf))
5404
5405 }
5406 }
5407
5408 state = fflib.FFParse_after_value
5409 goto mainparse
5410
5411 handle_ProfileSidebarFillColor:
5412
5413 /* handler: j.ProfileSidebarFillColor type=string kind=string quoted=false*/
5414
5415 {
5416
5417 {
5418 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5419 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5420 }
5421 }
5422
5423 if tok == fflib.FFTok_null {
5424
5425 } else {
5426
5427 outBuf := fs.Output.Bytes()
5428
5429 j.ProfileSidebarFillColor = string(string(outBuf))
5430
5431 }
5432 }
5433
5434 state = fflib.FFParse_after_value
5435 goto mainparse
5436
5437 handle_ProfileTextColor:
5438
5439 /* handler: j.ProfileTextColor type=string kind=string quoted=false*/
5440
5441 {
5442
5443 {
5444 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5445 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5446 }
5447 }
5448
5449 if tok == fflib.FFTok_null {
5450
5451 } else {
5452
5453 outBuf := fs.Output.Bytes()
5454
5455 j.ProfileTextColor = string(string(outBuf))
5456
5457 }
5458 }
5459
5460 state = fflib.FFParse_after_value
5461 goto mainparse
5462
5463 handle_ProfileUseBackgroundImage:
5464
5465 /* handler: j.ProfileUseBackgroundImage type=bool kind=bool quoted=false*/
5466
5467 {
5468 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5469 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5470 }
5471 }
5472
5473 {
5474 if tok == fflib.FFTok_null {
5475
5476 } else {
5477 tmpb := fs.Output.Bytes()
5478
5479 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5480
5481 j.ProfileUseBackgroundImage = true
5482
5483 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5484
5485 j.ProfileUseBackgroundImage = false
5486
5487 } else {
5488 err = errors.New("unexpected bytes for true/false value")
5489 return fs.WrapErr(err)
5490 }
5491
5492 }
5493 }
5494
5495 state = fflib.FFParse_after_value
5496 goto mainparse
5497
5498 handle_Protected:
5499
5500 /* handler: j.Protected type=bool kind=bool quoted=false*/
5501
5502 {
5503 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5504 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5505 }
5506 }
5507
5508 {
5509 if tok == fflib.FFTok_null {
5510
5511 } else {
5512 tmpb := fs.Output.Bytes()
5513
5514 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5515
5516 j.Protected = true
5517
5518 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5519
5520 j.Protected = false
5521
5522 } else {
5523 err = errors.New("unexpected bytes for true/false value")
5524 return fs.WrapErr(err)
5525 }
5526
5527 }
5528 }
5529
5530 state = fflib.FFParse_after_value
5531 goto mainparse
5532
5533 handle_ScreenName:
5534
5535 /* handler: j.ScreenName type=string kind=string quoted=false*/
5536
5537 {
5538
5539 {
5540 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5541 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5542 }
5543 }
5544
5545 if tok == fflib.FFTok_null {
5546
5547 } else {
5548
5549 outBuf := fs.Output.Bytes()
5550
5551 j.ScreenName = string(string(outBuf))
5552
5553 }
5554 }
5555
5556 state = fflib.FFParse_after_value
5557 goto mainparse
5558
5559 handle_ShowAllInlineMedia:
5560
5561 /* handler: j.ShowAllInlineMedia type=bool kind=bool quoted=false*/
5562
5563 {
5564 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5565 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5566 }
5567 }
5568
5569 {
5570 if tok == fflib.FFTok_null {
5571
5572 } else {
5573 tmpb := fs.Output.Bytes()
5574
5575 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5576
5577 j.ShowAllInlineMedia = true
5578
5579 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5580
5581 j.ShowAllInlineMedia = false
5582
5583 } else {
5584 err = errors.New("unexpected bytes for true/false value")
5585 return fs.WrapErr(err)
5586 }
5587
5588 }
5589 }
5590
5591 state = fflib.FFParse_after_value
5592 goto mainparse
5593
5594 handle_StatusesCount:
5595
5596 /* handler: j.StatusesCount type=int kind=int quoted=false*/
5597
5598 {
5599 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
5600 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
5601 }
5602 }
5603
5604 {
5605
5606 if tok == fflib.FFTok_null {
5607
5608 } else {
5609
5610 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
5611
5612 if err != nil {
5613 return fs.WrapErr(err)
5614 }
5615
5616 j.StatusesCount = int(tval)
5617
5618 }
5619 }
5620
5621 state = fflib.FFParse_after_value
5622 goto mainparse
5623
5624 handle_TimeZone:
5625
5626 /* handler: j.TimeZone type=string kind=string quoted=false*/
5627
5628 {
5629
5630 {
5631 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5632 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5633 }
5634 }
5635
5636 if tok == fflib.FFTok_null {
5637
5638 } else {
5639
5640 outBuf := fs.Output.Bytes()
5641
5642 j.TimeZone = string(string(outBuf))
5643
5644 }
5645 }
5646
5647 state = fflib.FFParse_after_value
5648 goto mainparse
5649
5650 handle_URL:
5651
5652 /* handler: j.URL type=string kind=string quoted=false*/
5653
5654 {
5655
5656 {
5657 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
5658 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
5659 }
5660 }
5661
5662 if tok == fflib.FFTok_null {
5663
5664 j.URL = nil
5665
5666 } else {
5667
5668 var tval string
5669 outBuf := fs.Output.Bytes()
5670
5671 tval = string(string(outBuf))
5672 j.URL = &tval
5673
5674 }
5675 }
5676
5677 state = fflib.FFParse_after_value
5678 goto mainparse
5679
5680 handle_UtcOffset:
5681
5682 /* handler: j.UtcOffset type=int kind=int quoted=false*/
5683
5684 {
5685 if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
5686 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
5687 }
5688 }
5689
5690 {
5691
5692 if tok == fflib.FFTok_null {
5693
5694 } else {
5695
5696 tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
5697
5698 if err != nil {
5699 return fs.WrapErr(err)
5700 }
5701
5702 j.UtcOffset = int(tval)
5703
5704 }
5705 }
5706
5707 state = fflib.FFParse_after_value
5708 goto mainparse
5709
5710 handle_Verified:
5711
5712 /* handler: j.Verified type=bool kind=bool quoted=false*/
5713
5714 {
5715 if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
5716 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
5717 }
5718 }
5719
5720 {
5721 if tok == fflib.FFTok_null {
5722
5723 } else {
5724 tmpb := fs.Output.Bytes()
5725
5726 if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
5727
5728 j.Verified = true
5729
5730 } else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
5731
5732 j.Verified = false
5733
5734 } else {
5735 err = errors.New("unexpected bytes for true/false value")
5736 return fs.WrapErr(err)
5737 }
5738
5739 }
5740 }
5741
5742 state = fflib.FFParse_after_value
5743 goto mainparse
5744
5745 wantedvalue:
5746 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
5747 wrongtokenerror:
5748 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
5749 tokerror:
5750 if fs.BigError != nil {
5751 return fs.WrapErr(fs.BigError)
5752 }
5753 err = fs.Error.ToError()
5754 if err != nil {
5755 return fs.WrapErr(err)
5756 }
5757 panic("ffjson-generated: unreachable, please report bug.")
5758 done:
5759
5760 return nil
5761 }
5762
5763 // MarshalJSON marshal bytes to json - template
5764 func (j *UserEntities) MarshalJSON() ([]byte, error) {
5765 var buf fflib.Buffer
5766 if j == nil {
5767 buf.WriteString("null")
5768 return buf.Bytes(), nil
5769 }
5770 err := j.MarshalJSONBuf(&buf)
5771 if err != nil {
5772 return nil, err
5773 }
5774 return buf.Bytes(), nil
5775 }
5776
5777 // MarshalJSONBuf marshal buff to json - template
5778 func (j *UserEntities) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
5779 if j == nil {
5780 buf.WriteString("null")
5781 return nil
5782 }
5783 var err error
5784 var obj []byte
5785 _ = obj
5786 _ = err
5787 buf.WriteString(`{"description":`)
5788
5789 {
5790
5791 err = j.Description.MarshalJSONBuf(buf)
5792 if err != nil {
5793 return err
5794 }
5795
5796 }
5797 buf.WriteString(`,"url":`)
5798
5799 {
5800
5801 err = j.URL.MarshalJSONBuf(buf)
5802 if err != nil {
5803 return err
5804 }
5805
5806 }
5807 buf.WriteByte('}')
5808 return nil
5809 }
5810
5811 const (
5812 ffjtUserEntitiesbase = iota
5813 ffjtUserEntitiesnosuchkey
5814
5815 ffjtUserEntitiesDescription
5816
5817 ffjtUserEntitiesURL
5818 )
5819
5820 var ffjKeyUserEntitiesDescription = []byte("description")
5821
5822 var ffjKeyUserEntitiesURL = []byte("url")
5823
5824 // UnmarshalJSON umarshall json - template of ffjson
5825 func (j *UserEntities) UnmarshalJSON(input []byte) error {
5826 fs := fflib.NewFFLexer(input)
5827 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
5828 }
5829
5830 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
5831 func (j *UserEntities) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
5832 var err error
5833 currentKey := ffjtUserEntitiesbase
5834 _ = currentKey
5835 tok := fflib.FFTok_init
5836 wantedTok := fflib.FFTok_init
5837
5838 mainparse:
5839 for {
5840 tok = fs.Scan()
5841 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
5842 if tok == fflib.FFTok_error {
5843 goto tokerror
5844 }
5845
5846 switch state {
5847
5848 case fflib.FFParse_map_start:
5849 if tok != fflib.FFTok_left_bracket {
5850 wantedTok = fflib.FFTok_left_bracket
5851 goto wrongtokenerror
5852 }
5853 state = fflib.FFParse_want_key
5854 continue
5855
5856 case fflib.FFParse_after_value:
5857 if tok == fflib.FFTok_comma {
5858 state = fflib.FFParse_want_key
5859 } else if tok == fflib.FFTok_right_bracket {
5860 goto done
5861 } else {
5862 wantedTok = fflib.FFTok_comma
5863 goto wrongtokenerror
5864 }
5865
5866 case fflib.FFParse_want_key:
5867 // json {} ended. goto exit. woo.
5868 if tok == fflib.FFTok_right_bracket {
5869 goto done
5870 }
5871 if tok != fflib.FFTok_string {
5872 wantedTok = fflib.FFTok_string
5873 goto wrongtokenerror
5874 }
5875
5876 kn := fs.Output.Bytes()
5877 if len(kn) <= 0 {
5878 // "" case. hrm.
5879 currentKey = ffjtUserEntitiesnosuchkey
5880 state = fflib.FFParse_want_colon
5881 goto mainparse
5882 } else {
5883 switch kn[0] {
5884
5885 case 'd':
5886
5887 if bytes.Equal(ffjKeyUserEntitiesDescription, kn) {
5888 currentKey = ffjtUserEntitiesDescription
5889 state = fflib.FFParse_want_colon
5890 goto mainparse
5891 }
5892
5893 case 'u':
5894
5895 if bytes.Equal(ffjKeyUserEntitiesURL, kn) {
5896 currentKey = ffjtUserEntitiesURL
5897 state = fflib.FFParse_want_colon
5898 goto mainparse
5899 }
5900
5901 }
5902
5903 if fflib.SimpleLetterEqualFold(ffjKeyUserEntitiesURL, kn) {
5904 currentKey = ffjtUserEntitiesURL
5905 state = fflib.FFParse_want_colon
5906 goto mainparse
5907 }
5908
5909 if fflib.EqualFoldRight(ffjKeyUserEntitiesDescription, kn) {
5910 currentKey = ffjtUserEntitiesDescription
5911 state = fflib.FFParse_want_colon
5912 goto mainparse
5913 }
5914
5915 currentKey = ffjtUserEntitiesnosuchkey
5916 state = fflib.FFParse_want_colon
5917 goto mainparse
5918 }
5919
5920 case fflib.FFParse_want_colon:
5921 if tok != fflib.FFTok_colon {
5922 wantedTok = fflib.FFTok_colon
5923 goto wrongtokenerror
5924 }
5925 state = fflib.FFParse_want_value
5926 continue
5927 case fflib.FFParse_want_value:
5928
5929 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
5930 switch currentKey {
5931
5932 case ffjtUserEntitiesDescription:
5933 goto handle_Description
5934
5935 case ffjtUserEntitiesURL:
5936 goto handle_URL
5937
5938 case ffjtUserEntitiesnosuchkey:
5939 err = fs.SkipField(tok)
5940 if err != nil {
5941 return fs.WrapErr(err)
5942 }
5943 state = fflib.FFParse_after_value
5944 goto mainparse
5945 }
5946 } else {
5947 goto wantedvalue
5948 }
5949 }
5950 }
5951
5952 handle_Description:
5953
5954 /* handler: j.Description type=benchmark.UserEntityDescription kind=struct quoted=false*/
5955
5956 {
5957 if tok == fflib.FFTok_null {
5958
5959 } else {
5960
5961 err = j.Description.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
5962 if err != nil {
5963 return err
5964 }
5965 }
5966 state = fflib.FFParse_after_value
5967 }
5968
5969 state = fflib.FFParse_after_value
5970 goto mainparse
5971
5972 handle_URL:
5973
5974 /* handler: j.URL type=benchmark.UserEntityURL kind=struct quoted=false*/
5975
5976 {
5977 if tok == fflib.FFTok_null {
5978
5979 } else {
5980
5981 err = j.URL.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
5982 if err != nil {
5983 return err
5984 }
5985 }
5986 state = fflib.FFParse_after_value
5987 }
5988
5989 state = fflib.FFParse_after_value
5990 goto mainparse
5991
5992 wantedvalue:
5993 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
5994 wrongtokenerror:
5995 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
5996 tokerror:
5997 if fs.BigError != nil {
5998 return fs.WrapErr(fs.BigError)
5999 }
6000 err = fs.Error.ToError()
6001 if err != nil {
6002 return fs.WrapErr(err)
6003 }
6004 panic("ffjson-generated: unreachable, please report bug.")
6005 done:
6006
6007 return nil
6008 }
6009
6010 // MarshalJSON marshal bytes to json - template
6011 func (j *UserEntityDescription) MarshalJSON() ([]byte, error) {
6012 var buf fflib.Buffer
6013 if j == nil {
6014 buf.WriteString("null")
6015 return buf.Bytes(), nil
6016 }
6017 err := j.MarshalJSONBuf(&buf)
6018 if err != nil {
6019 return nil, err
6020 }
6021 return buf.Bytes(), nil
6022 }
6023
6024 // MarshalJSONBuf marshal buff to json - template
6025 func (j *UserEntityDescription) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
6026 if j == nil {
6027 buf.WriteString("null")
6028 return nil
6029 }
6030 var err error
6031 var obj []byte
6032 _ = obj
6033 _ = err
6034 buf.WriteString(`{"urls":`)
6035 if j.Urls != nil {
6036 buf.WriteString(`[`)
6037 for i, v := range j.Urls {
6038 if i != 0 {
6039 buf.WriteString(`,`)
6040 }
6041 if v != nil {
6042 fflib.WriteJsonString(buf, string(*v))
6043 } else {
6044 buf.WriteString(`null`)
6045 }
6046 }
6047 buf.WriteString(`]`)
6048 } else {
6049 buf.WriteString(`null`)
6050 }
6051 buf.WriteByte('}')
6052 return nil
6053 }
6054
6055 const (
6056 ffjtUserEntityDescriptionbase = iota
6057 ffjtUserEntityDescriptionnosuchkey
6058
6059 ffjtUserEntityDescriptionUrls
6060 )
6061
6062 var ffjKeyUserEntityDescriptionUrls = []byte("urls")
6063
6064 // UnmarshalJSON umarshall json - template of ffjson
6065 func (j *UserEntityDescription) UnmarshalJSON(input []byte) error {
6066 fs := fflib.NewFFLexer(input)
6067 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
6068 }
6069
6070 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
6071 func (j *UserEntityDescription) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
6072 var err error
6073 currentKey := ffjtUserEntityDescriptionbase
6074 _ = currentKey
6075 tok := fflib.FFTok_init
6076 wantedTok := fflib.FFTok_init
6077
6078 mainparse:
6079 for {
6080 tok = fs.Scan()
6081 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
6082 if tok == fflib.FFTok_error {
6083 goto tokerror
6084 }
6085
6086 switch state {
6087
6088 case fflib.FFParse_map_start:
6089 if tok != fflib.FFTok_left_bracket {
6090 wantedTok = fflib.FFTok_left_bracket
6091 goto wrongtokenerror
6092 }
6093 state = fflib.FFParse_want_key
6094 continue
6095
6096 case fflib.FFParse_after_value:
6097 if tok == fflib.FFTok_comma {
6098 state = fflib.FFParse_want_key
6099 } else if tok == fflib.FFTok_right_bracket {
6100 goto done
6101 } else {
6102 wantedTok = fflib.FFTok_comma
6103 goto wrongtokenerror
6104 }
6105
6106 case fflib.FFParse_want_key:
6107 // json {} ended. goto exit. woo.
6108 if tok == fflib.FFTok_right_bracket {
6109 goto done
6110 }
6111 if tok != fflib.FFTok_string {
6112 wantedTok = fflib.FFTok_string
6113 goto wrongtokenerror
6114 }
6115
6116 kn := fs.Output.Bytes()
6117 if len(kn) <= 0 {
6118 // "" case. hrm.
6119 currentKey = ffjtUserEntityDescriptionnosuchkey
6120 state = fflib.FFParse_want_colon
6121 goto mainparse
6122 } else {
6123 switch kn[0] {
6124
6125 case 'u':
6126
6127 if bytes.Equal(ffjKeyUserEntityDescriptionUrls, kn) {
6128 currentKey = ffjtUserEntityDescriptionUrls
6129 state = fflib.FFParse_want_colon
6130 goto mainparse
6131 }
6132
6133 }
6134
6135 if fflib.EqualFoldRight(ffjKeyUserEntityDescriptionUrls, kn) {
6136 currentKey = ffjtUserEntityDescriptionUrls
6137 state = fflib.FFParse_want_colon
6138 goto mainparse
6139 }
6140
6141 currentKey = ffjtUserEntityDescriptionnosuchkey
6142 state = fflib.FFParse_want_colon
6143 goto mainparse
6144 }
6145
6146 case fflib.FFParse_want_colon:
6147 if tok != fflib.FFTok_colon {
6148 wantedTok = fflib.FFTok_colon
6149 goto wrongtokenerror
6150 }
6151 state = fflib.FFParse_want_value
6152 continue
6153 case fflib.FFParse_want_value:
6154
6155 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
6156 switch currentKey {
6157
6158 case ffjtUserEntityDescriptionUrls:
6159 goto handle_Urls
6160
6161 case ffjtUserEntityDescriptionnosuchkey:
6162 err = fs.SkipField(tok)
6163 if err != nil {
6164 return fs.WrapErr(err)
6165 }
6166 state = fflib.FFParse_after_value
6167 goto mainparse
6168 }
6169 } else {
6170 goto wantedvalue
6171 }
6172 }
6173 }
6174
6175 handle_Urls:
6176
6177 /* handler: j.Urls type=[]*string kind=slice quoted=false*/
6178
6179 {
6180
6181 {
6182 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
6183 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
6184 }
6185 }
6186
6187 if tok == fflib.FFTok_null {
6188 j.Urls = nil
6189 } else {
6190
6191 j.Urls = []*string{}
6192
6193 wantVal := true
6194
6195 for {
6196
6197 var tmpJUrls *string
6198
6199 tok = fs.Scan()
6200 if tok == fflib.FFTok_error {
6201 goto tokerror
6202 }
6203 if tok == fflib.FFTok_right_brace {
6204 break
6205 }
6206
6207 if tok == fflib.FFTok_comma {
6208 if wantVal == true {
6209 // TODO(pquerna): this isn't an ideal error message, this handles
6210 // things like [,,,] as an array value.
6211 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6212 }
6213 continue
6214 } else {
6215 wantVal = true
6216 }
6217
6218 /* handler: tmpJUrls type=*string kind=ptr quoted=false*/
6219
6220 {
6221
6222 if tok == fflib.FFTok_null {
6223 tmpJUrls = nil
6224 } else {
6225 if tmpJUrls == nil {
6226 tmpJUrls = new(string)
6227 }
6228
6229 /* handler: tmpJUrls type=string kind=string quoted=false*/
6230
6231 {
6232
6233 {
6234 if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
6235 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
6236 }
6237 }
6238
6239 if tok == fflib.FFTok_null {
6240
6241 tmpJUrls = nil
6242
6243 } else {
6244
6245 var tval string
6246 outBuf := fs.Output.Bytes()
6247
6248 tval = string(string(outBuf))
6249 tmpJUrls = &tval
6250
6251 }
6252 }
6253
6254 }
6255 }
6256
6257 j.Urls = append(j.Urls, tmpJUrls)
6258
6259 wantVal = false
6260 }
6261 }
6262 }
6263
6264 state = fflib.FFParse_after_value
6265 goto mainparse
6266
6267 wantedvalue:
6268 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6269 wrongtokenerror:
6270 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
6271 tokerror:
6272 if fs.BigError != nil {
6273 return fs.WrapErr(fs.BigError)
6274 }
6275 err = fs.Error.ToError()
6276 if err != nil {
6277 return fs.WrapErr(err)
6278 }
6279 panic("ffjson-generated: unreachable, please report bug.")
6280 done:
6281
6282 return nil
6283 }
6284
6285 // MarshalJSON marshal bytes to json - template
6286 func (j *UserEntityURL) MarshalJSON() ([]byte, error) {
6287 var buf fflib.Buffer
6288 if j == nil {
6289 buf.WriteString("null")
6290 return buf.Bytes(), nil
6291 }
6292 err := j.MarshalJSONBuf(&buf)
6293 if err != nil {
6294 return nil, err
6295 }
6296 return buf.Bytes(), nil
6297 }
6298
6299 // MarshalJSONBuf marshal buff to json - template
6300 func (j *UserEntityURL) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
6301 if j == nil {
6302 buf.WriteString("null")
6303 return nil
6304 }
6305 var err error
6306 var obj []byte
6307 _ = obj
6308 _ = err
6309 buf.WriteString(`{"urls":`)
6310 if j.Urls != nil {
6311 buf.WriteString(`[`)
6312 for i, v := range j.Urls {
6313 if i != 0 {
6314 buf.WriteString(`,`)
6315 }
6316
6317 {
6318
6319 err = v.MarshalJSONBuf(buf)
6320 if err != nil {
6321 return err
6322 }
6323
6324 }
6325 }
6326 buf.WriteString(`]`)
6327 } else {
6328 buf.WriteString(`null`)
6329 }
6330 buf.WriteByte('}')
6331 return nil
6332 }
6333
6334 const (
6335 ffjtUserEntityURLbase = iota
6336 ffjtUserEntityURLnosuchkey
6337
6338 ffjtUserEntityURLUrls
6339 )
6340
6341 var ffjKeyUserEntityURLUrls = []byte("urls")
6342
6343 // UnmarshalJSON umarshall json - template of ffjson
6344 func (j *UserEntityURL) UnmarshalJSON(input []byte) error {
6345 fs := fflib.NewFFLexer(input)
6346 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
6347 }
6348
6349 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
6350 func (j *UserEntityURL) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
6351 var err error
6352 currentKey := ffjtUserEntityURLbase
6353 _ = currentKey
6354 tok := fflib.FFTok_init
6355 wantedTok := fflib.FFTok_init
6356
6357 mainparse:
6358 for {
6359 tok = fs.Scan()
6360 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
6361 if tok == fflib.FFTok_error {
6362 goto tokerror
6363 }
6364
6365 switch state {
6366
6367 case fflib.FFParse_map_start:
6368 if tok != fflib.FFTok_left_bracket {
6369 wantedTok = fflib.FFTok_left_bracket
6370 goto wrongtokenerror
6371 }
6372 state = fflib.FFParse_want_key
6373 continue
6374
6375 case fflib.FFParse_after_value:
6376 if tok == fflib.FFTok_comma {
6377 state = fflib.FFParse_want_key
6378 } else if tok == fflib.FFTok_right_bracket {
6379 goto done
6380 } else {
6381 wantedTok = fflib.FFTok_comma
6382 goto wrongtokenerror
6383 }
6384
6385 case fflib.FFParse_want_key:
6386 // json {} ended. goto exit. woo.
6387 if tok == fflib.FFTok_right_bracket {
6388 goto done
6389 }
6390 if tok != fflib.FFTok_string {
6391 wantedTok = fflib.FFTok_string
6392 goto wrongtokenerror
6393 }
6394
6395 kn := fs.Output.Bytes()
6396 if len(kn) <= 0 {
6397 // "" case. hrm.
6398 currentKey = ffjtUserEntityURLnosuchkey
6399 state = fflib.FFParse_want_colon
6400 goto mainparse
6401 } else {
6402 switch kn[0] {
6403
6404 case 'u':
6405
6406 if bytes.Equal(ffjKeyUserEntityURLUrls, kn) {
6407 currentKey = ffjtUserEntityURLUrls
6408 state = fflib.FFParse_want_colon
6409 goto mainparse
6410 }
6411
6412 }
6413
6414 if fflib.EqualFoldRight(ffjKeyUserEntityURLUrls, kn) {
6415 currentKey = ffjtUserEntityURLUrls
6416 state = fflib.FFParse_want_colon
6417 goto mainparse
6418 }
6419
6420 currentKey = ffjtUserEntityURLnosuchkey
6421 state = fflib.FFParse_want_colon
6422 goto mainparse
6423 }
6424
6425 case fflib.FFParse_want_colon:
6426 if tok != fflib.FFTok_colon {
6427 wantedTok = fflib.FFTok_colon
6428 goto wrongtokenerror
6429 }
6430 state = fflib.FFParse_want_value
6431 continue
6432 case fflib.FFParse_want_value:
6433
6434 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
6435 switch currentKey {
6436
6437 case ffjtUserEntityURLUrls:
6438 goto handle_Urls
6439
6440 case ffjtUserEntityURLnosuchkey:
6441 err = fs.SkipField(tok)
6442 if err != nil {
6443 return fs.WrapErr(err)
6444 }
6445 state = fflib.FFParse_after_value
6446 goto mainparse
6447 }
6448 } else {
6449 goto wantedvalue
6450 }
6451 }
6452 }
6453
6454 handle_Urls:
6455
6456 /* handler: j.Urls type=[]benchmark.URL kind=slice quoted=false*/
6457
6458 {
6459
6460 {
6461 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
6462 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
6463 }
6464 }
6465
6466 if tok == fflib.FFTok_null {
6467 j.Urls = nil
6468 } else {
6469
6470 j.Urls = []URL{}
6471
6472 wantVal := true
6473
6474 for {
6475
6476 var tmpJUrls URL
6477
6478 tok = fs.Scan()
6479 if tok == fflib.FFTok_error {
6480 goto tokerror
6481 }
6482 if tok == fflib.FFTok_right_brace {
6483 break
6484 }
6485
6486 if tok == fflib.FFTok_comma {
6487 if wantVal == true {
6488 // TODO(pquerna): this isn't an ideal error message, this handles
6489 // things like [,,,] as an array value.
6490 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6491 }
6492 continue
6493 } else {
6494 wantVal = true
6495 }
6496
6497 /* handler: tmpJUrls type=benchmark.URL kind=struct quoted=false*/
6498
6499 {
6500 if tok == fflib.FFTok_null {
6501
6502 } else {
6503
6504 err = tmpJUrls.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
6505 if err != nil {
6506 return err
6507 }
6508 }
6509 state = fflib.FFParse_after_value
6510 }
6511
6512 j.Urls = append(j.Urls, tmpJUrls)
6513
6514 wantVal = false
6515 }
6516 }
6517 }
6518
6519 state = fflib.FFParse_after_value
6520 goto mainparse
6521
6522 wantedvalue:
6523 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6524 wrongtokenerror:
6525 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
6526 tokerror:
6527 if fs.BigError != nil {
6528 return fs.WrapErr(fs.BigError)
6529 }
6530 err = fs.Error.ToError()
6531 if err != nil {
6532 return fs.WrapErr(err)
6533 }
6534 panic("ffjson-generated: unreachable, please report bug.")
6535 done:
6536
6537 return nil
6538 }
6539
6540 // MarshalJSON marshal bytes to json - template
6541 func (j *XLStruct) MarshalJSON() ([]byte, error) {
6542 var buf fflib.Buffer
6543 if j == nil {
6544 buf.WriteString("null")
6545 return buf.Bytes(), nil
6546 }
6547 err := j.MarshalJSONBuf(&buf)
6548 if err != nil {
6549 return nil, err
6550 }
6551 return buf.Bytes(), nil
6552 }
6553
6554 // MarshalJSONBuf marshal buff to json - template
6555 func (j *XLStruct) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
6556 if j == nil {
6557 buf.WriteString("null")
6558 return nil
6559 }
6560 var err error
6561 var obj []byte
6562 _ = obj
6563 _ = err
6564 buf.WriteString(`{"Data":`)
6565 if j.Data != nil {
6566 buf.WriteString(`[`)
6567 for i, v := range j.Data {
6568 if i != 0 {
6569 buf.WriteString(`,`)
6570 }
6571
6572 {
6573
6574 err = v.MarshalJSONBuf(buf)
6575 if err != nil {
6576 return err
6577 }
6578
6579 }
6580 }
6581 buf.WriteString(`]`)
6582 } else {
6583 buf.WriteString(`null`)
6584 }
6585 buf.WriteByte('}')
6586 return nil
6587 }
6588
6589 const (
6590 ffjtXLStructbase = iota
6591 ffjtXLStructnosuchkey
6592
6593 ffjtXLStructData
6594 )
6595
6596 var ffjKeyXLStructData = []byte("Data")
6597
6598 // UnmarshalJSON umarshall json - template of ffjson
6599 func (j *XLStruct) UnmarshalJSON(input []byte) error {
6600 fs := fflib.NewFFLexer(input)
6601 return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
6602 }
6603
6604 // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
6605 func (j *XLStruct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
6606 var err error
6607 currentKey := ffjtXLStructbase
6608 _ = currentKey
6609 tok := fflib.FFTok_init
6610 wantedTok := fflib.FFTok_init
6611
6612 mainparse:
6613 for {
6614 tok = fs.Scan()
6615 // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state))
6616 if tok == fflib.FFTok_error {
6617 goto tokerror
6618 }
6619
6620 switch state {
6621
6622 case fflib.FFParse_map_start:
6623 if tok != fflib.FFTok_left_bracket {
6624 wantedTok = fflib.FFTok_left_bracket
6625 goto wrongtokenerror
6626 }
6627 state = fflib.FFParse_want_key
6628 continue
6629
6630 case fflib.FFParse_after_value:
6631 if tok == fflib.FFTok_comma {
6632 state = fflib.FFParse_want_key
6633 } else if tok == fflib.FFTok_right_bracket {
6634 goto done
6635 } else {
6636 wantedTok = fflib.FFTok_comma
6637 goto wrongtokenerror
6638 }
6639
6640 case fflib.FFParse_want_key:
6641 // json {} ended. goto exit. woo.
6642 if tok == fflib.FFTok_right_bracket {
6643 goto done
6644 }
6645 if tok != fflib.FFTok_string {
6646 wantedTok = fflib.FFTok_string
6647 goto wrongtokenerror
6648 }
6649
6650 kn := fs.Output.Bytes()
6651 if len(kn) <= 0 {
6652 // "" case. hrm.
6653 currentKey = ffjtXLStructnosuchkey
6654 state = fflib.FFParse_want_colon
6655 goto mainparse
6656 } else {
6657 switch kn[0] {
6658
6659 case 'D':
6660
6661 if bytes.Equal(ffjKeyXLStructData, kn) {
6662 currentKey = ffjtXLStructData
6663 state = fflib.FFParse_want_colon
6664 goto mainparse
6665 }
6666
6667 }
6668
6669 if fflib.SimpleLetterEqualFold(ffjKeyXLStructData, kn) {
6670 currentKey = ffjtXLStructData
6671 state = fflib.FFParse_want_colon
6672 goto mainparse
6673 }
6674
6675 currentKey = ffjtXLStructnosuchkey
6676 state = fflib.FFParse_want_colon
6677 goto mainparse
6678 }
6679
6680 case fflib.FFParse_want_colon:
6681 if tok != fflib.FFTok_colon {
6682 wantedTok = fflib.FFTok_colon
6683 goto wrongtokenerror
6684 }
6685 state = fflib.FFParse_want_value
6686 continue
6687 case fflib.FFParse_want_value:
6688
6689 if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
6690 switch currentKey {
6691
6692 case ffjtXLStructData:
6693 goto handle_Data
6694
6695 case ffjtXLStructnosuchkey:
6696 err = fs.SkipField(tok)
6697 if err != nil {
6698 return fs.WrapErr(err)
6699 }
6700 state = fflib.FFParse_after_value
6701 goto mainparse
6702 }
6703 } else {
6704 goto wantedvalue
6705 }
6706 }
6707 }
6708
6709 handle_Data:
6710
6711 /* handler: j.Data type=[]benchmark.LargeStruct kind=slice quoted=false*/
6712
6713 {
6714
6715 {
6716 if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
6717 return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
6718 }
6719 }
6720
6721 if tok == fflib.FFTok_null {
6722 j.Data = nil
6723 } else {
6724
6725 j.Data = []LargeStruct{}
6726
6727 wantVal := true
6728
6729 for {
6730
6731 var tmpJData LargeStruct
6732
6733 tok = fs.Scan()
6734 if tok == fflib.FFTok_error {
6735 goto tokerror
6736 }
6737 if tok == fflib.FFTok_right_brace {
6738 break
6739 }
6740
6741 if tok == fflib.FFTok_comma {
6742 if wantVal == true {
6743 // TODO(pquerna): this isn't an ideal error message, this handles
6744 // things like [,,,] as an array value.
6745 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6746 }
6747 continue
6748 } else {
6749 wantVal = true
6750 }
6751
6752 /* handler: tmpJData type=benchmark.LargeStruct kind=struct quoted=false*/
6753
6754 {
6755 if tok == fflib.FFTok_null {
6756
6757 } else {
6758
6759 err = tmpJData.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
6760 if err != nil {
6761 return err
6762 }
6763 }
6764 state = fflib.FFParse_after_value
6765 }
6766
6767 j.Data = append(j.Data, tmpJData)
6768
6769 wantVal = false
6770 }
6771 }
6772 }
6773
6774 state = fflib.FFParse_after_value
6775 goto mainparse
6776
6777 wantedvalue:
6778 return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
6779 wrongtokenerror:
6780 return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
6781 tokerror:
6782 if fs.BigError != nil {
6783 return fs.WrapErr(fs.BigError)
6784 }
6785 err = fs.Error.ToError()
6786 if err != nil {
6787 return fs.WrapErr(err)
6788 }
6789 panic("ffjson-generated: unreachable, please report bug.")
6790 done:
6791
6792 return nil
6793 }