-
Notifications
You must be signed in to change notification settings - Fork 22
/
one.pb.go
5069 lines (4923 loc) · 143 KB
/
one.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/unmarshaler/one.proto
/*
Package one is a generated protocol buffer package.
It is generated from these files:
combos/unmarshaler/one.proto
It has these top-level messages:
Subby
AllTypesOneOf
TwoOneofs
CustomOneof
*/
package one
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import github_com_gogo_protobuf_test_custom "github.com/gogo/protobuf/test/custom"
import github_com_gogo_protobuf_test_casttype "github.com/gogo/protobuf/test/casttype"
import descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
import gzip "compress/gzip"
import bytes "bytes"
import ioutil "io/ioutil"
import strings "strings"
import reflect "reflect"
import io "io"
import binary "encoding/binary"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type Subby struct {
Sub *string `protobuf:"bytes,1,opt,name=sub" json:"sub,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Subby) Reset() { *m = Subby{} }
func (*Subby) ProtoMessage() {}
func (*Subby) Descriptor() ([]byte, []int) { return fileDescriptorOne, []int{0} }
type AllTypesOneOf struct {
// Types that are valid to be assigned to TestOneof:
// *AllTypesOneOf_Field1
// *AllTypesOneOf_Field2
// *AllTypesOneOf_Field3
// *AllTypesOneOf_Field4
// *AllTypesOneOf_Field5
// *AllTypesOneOf_Field6
// *AllTypesOneOf_Field7
// *AllTypesOneOf_Field8
// *AllTypesOneOf_Field9
// *AllTypesOneOf_Field10
// *AllTypesOneOf_Field11
// *AllTypesOneOf_Field12
// *AllTypesOneOf_Field13
// *AllTypesOneOf_Field14
// *AllTypesOneOf_Field15
// *AllTypesOneOf_SubMessage
TestOneof isAllTypesOneOf_TestOneof `protobuf_oneof:"test_oneof"`
XXX_unrecognized []byte `json:"-"`
}
func (m *AllTypesOneOf) Reset() { *m = AllTypesOneOf{} }
func (*AllTypesOneOf) ProtoMessage() {}
func (*AllTypesOneOf) Descriptor() ([]byte, []int) { return fileDescriptorOne, []int{1} }
type isAllTypesOneOf_TestOneof interface {
isAllTypesOneOf_TestOneof()
Equal(interface{}) bool
VerboseEqual(interface{}) error
Size() int
}
type AllTypesOneOf_Field1 struct {
Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"`
}
type AllTypesOneOf_Field2 struct {
Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"`
}
type AllTypesOneOf_Field3 struct {
Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"`
}
type AllTypesOneOf_Field4 struct {
Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof"`
}
type AllTypesOneOf_Field5 struct {
Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof"`
}
type AllTypesOneOf_Field6 struct {
Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof"`
}
type AllTypesOneOf_Field7 struct {
Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof"`
}
type AllTypesOneOf_Field8 struct {
Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof"`
}
type AllTypesOneOf_Field9 struct {
Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof"`
}
type AllTypesOneOf_Field10 struct {
Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof"`
}
type AllTypesOneOf_Field11 struct {
Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof"`
}
type AllTypesOneOf_Field12 struct {
Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof"`
}
type AllTypesOneOf_Field13 struct {
Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof"`
}
type AllTypesOneOf_Field14 struct {
Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof"`
}
type AllTypesOneOf_Field15 struct {
Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof"`
}
type AllTypesOneOf_SubMessage struct {
SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof"`
}
func (*AllTypesOneOf_Field1) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field2) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field3) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field4) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field5) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field6) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field7) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field8) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field9) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field10) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field11) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field12) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field13) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field14) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_Field15) isAllTypesOneOf_TestOneof() {}
func (*AllTypesOneOf_SubMessage) isAllTypesOneOf_TestOneof() {}
func (m *AllTypesOneOf) GetTestOneof() isAllTypesOneOf_TestOneof {
if m != nil {
return m.TestOneof
}
return nil
}
func (m *AllTypesOneOf) GetField1() float64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field1); ok {
return x.Field1
}
return 0
}
func (m *AllTypesOneOf) GetField2() float32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field2); ok {
return x.Field2
}
return 0
}
func (m *AllTypesOneOf) GetField3() int32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field3); ok {
return x.Field3
}
return 0
}
func (m *AllTypesOneOf) GetField4() int64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field4); ok {
return x.Field4
}
return 0
}
func (m *AllTypesOneOf) GetField5() uint32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field5); ok {
return x.Field5
}
return 0
}
func (m *AllTypesOneOf) GetField6() uint64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field6); ok {
return x.Field6
}
return 0
}
func (m *AllTypesOneOf) GetField7() int32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field7); ok {
return x.Field7
}
return 0
}
func (m *AllTypesOneOf) GetField8() int64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field8); ok {
return x.Field8
}
return 0
}
func (m *AllTypesOneOf) GetField9() uint32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field9); ok {
return x.Field9
}
return 0
}
func (m *AllTypesOneOf) GetField10() int32 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field10); ok {
return x.Field10
}
return 0
}
func (m *AllTypesOneOf) GetField11() uint64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field11); ok {
return x.Field11
}
return 0
}
func (m *AllTypesOneOf) GetField12() int64 {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field12); ok {
return x.Field12
}
return 0
}
func (m *AllTypesOneOf) GetField13() bool {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field13); ok {
return x.Field13
}
return false
}
func (m *AllTypesOneOf) GetField14() string {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field14); ok {
return x.Field14
}
return ""
}
func (m *AllTypesOneOf) GetField15() []byte {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_Field15); ok {
return x.Field15
}
return nil
}
func (m *AllTypesOneOf) GetSubMessage() *Subby {
if x, ok := m.GetTestOneof().(*AllTypesOneOf_SubMessage); ok {
return x.SubMessage
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*AllTypesOneOf) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _AllTypesOneOf_OneofMarshaler, _AllTypesOneOf_OneofUnmarshaler, _AllTypesOneOf_OneofSizer, []interface{}{
(*AllTypesOneOf_Field1)(nil),
(*AllTypesOneOf_Field2)(nil),
(*AllTypesOneOf_Field3)(nil),
(*AllTypesOneOf_Field4)(nil),
(*AllTypesOneOf_Field5)(nil),
(*AllTypesOneOf_Field6)(nil),
(*AllTypesOneOf_Field7)(nil),
(*AllTypesOneOf_Field8)(nil),
(*AllTypesOneOf_Field9)(nil),
(*AllTypesOneOf_Field10)(nil),
(*AllTypesOneOf_Field11)(nil),
(*AllTypesOneOf_Field12)(nil),
(*AllTypesOneOf_Field13)(nil),
(*AllTypesOneOf_Field14)(nil),
(*AllTypesOneOf_Field15)(nil),
(*AllTypesOneOf_SubMessage)(nil),
}
}
func _AllTypesOneOf_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*AllTypesOneOf)
// test_oneof
switch x := m.TestOneof.(type) {
case *AllTypesOneOf_Field1:
_ = b.EncodeVarint(1<<3 | proto.WireFixed64)
_ = b.EncodeFixed64(math.Float64bits(x.Field1))
case *AllTypesOneOf_Field2:
_ = b.EncodeVarint(2<<3 | proto.WireFixed32)
_ = b.EncodeFixed32(uint64(math.Float32bits(x.Field2)))
case *AllTypesOneOf_Field3:
_ = b.EncodeVarint(3<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.Field3))
case *AllTypesOneOf_Field4:
_ = b.EncodeVarint(4<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.Field4))
case *AllTypesOneOf_Field5:
_ = b.EncodeVarint(5<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.Field5))
case *AllTypesOneOf_Field6:
_ = b.EncodeVarint(6<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.Field6))
case *AllTypesOneOf_Field7:
_ = b.EncodeVarint(7<<3 | proto.WireVarint)
_ = b.EncodeZigzag32(uint64(x.Field7))
case *AllTypesOneOf_Field8:
_ = b.EncodeVarint(8<<3 | proto.WireVarint)
_ = b.EncodeZigzag64(uint64(x.Field8))
case *AllTypesOneOf_Field9:
_ = b.EncodeVarint(9<<3 | proto.WireFixed32)
_ = b.EncodeFixed32(uint64(x.Field9))
case *AllTypesOneOf_Field10:
_ = b.EncodeVarint(10<<3 | proto.WireFixed32)
_ = b.EncodeFixed32(uint64(x.Field10))
case *AllTypesOneOf_Field11:
_ = b.EncodeVarint(11<<3 | proto.WireFixed64)
_ = b.EncodeFixed64(uint64(x.Field11))
case *AllTypesOneOf_Field12:
_ = b.EncodeVarint(12<<3 | proto.WireFixed64)
_ = b.EncodeFixed64(uint64(x.Field12))
case *AllTypesOneOf_Field13:
t := uint64(0)
if x.Field13 {
t = 1
}
_ = b.EncodeVarint(13<<3 | proto.WireVarint)
_ = b.EncodeVarint(t)
case *AllTypesOneOf_Field14:
_ = b.EncodeVarint(14<<3 | proto.WireBytes)
_ = b.EncodeStringBytes(x.Field14)
case *AllTypesOneOf_Field15:
_ = b.EncodeVarint(15<<3 | proto.WireBytes)
_ = b.EncodeRawBytes(x.Field15)
case *AllTypesOneOf_SubMessage:
_ = b.EncodeVarint(16<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.SubMessage); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("AllTypesOneOf.TestOneof has unexpected type %T", x)
}
return nil
}
func _AllTypesOneOf_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*AllTypesOneOf)
switch tag {
case 1: // test_oneof.Field1
if wire != proto.WireFixed64 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed64()
m.TestOneof = &AllTypesOneOf_Field1{math.Float64frombits(x)}
return true, err
case 2: // test_oneof.Field2
if wire != proto.WireFixed32 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed32()
m.TestOneof = &AllTypesOneOf_Field2{math.Float32frombits(uint32(x))}
return true, err
case 3: // test_oneof.Field3
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.TestOneof = &AllTypesOneOf_Field3{int32(x)}
return true, err
case 4: // test_oneof.Field4
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.TestOneof = &AllTypesOneOf_Field4{int64(x)}
return true, err
case 5: // test_oneof.Field5
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.TestOneof = &AllTypesOneOf_Field5{uint32(x)}
return true, err
case 6: // test_oneof.Field6
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.TestOneof = &AllTypesOneOf_Field6{x}
return true, err
case 7: // test_oneof.Field7
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeZigzag32()
m.TestOneof = &AllTypesOneOf_Field7{int32(x)}
return true, err
case 8: // test_oneof.Field8
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeZigzag64()
m.TestOneof = &AllTypesOneOf_Field8{int64(x)}
return true, err
case 9: // test_oneof.Field9
if wire != proto.WireFixed32 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed32()
m.TestOneof = &AllTypesOneOf_Field9{uint32(x)}
return true, err
case 10: // test_oneof.Field10
if wire != proto.WireFixed32 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed32()
m.TestOneof = &AllTypesOneOf_Field10{int32(x)}
return true, err
case 11: // test_oneof.Field11
if wire != proto.WireFixed64 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed64()
m.TestOneof = &AllTypesOneOf_Field11{x}
return true, err
case 12: // test_oneof.Field12
if wire != proto.WireFixed64 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed64()
m.TestOneof = &AllTypesOneOf_Field12{int64(x)}
return true, err
case 13: // test_oneof.Field13
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.TestOneof = &AllTypesOneOf_Field13{x != 0}
return true, err
case 14: // test_oneof.Field14
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.TestOneof = &AllTypesOneOf_Field14{x}
return true, err
case 15: // test_oneof.Field15
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeRawBytes(true)
m.TestOneof = &AllTypesOneOf_Field15{x}
return true, err
case 16: // test_oneof.sub_message
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(Subby)
err := b.DecodeMessage(msg)
m.TestOneof = &AllTypesOneOf_SubMessage{msg}
return true, err
default:
return false, nil
}
}
func _AllTypesOneOf_OneofSizer(msg proto.Message) (n int) {
m := msg.(*AllTypesOneOf)
// test_oneof
switch x := m.TestOneof.(type) {
case *AllTypesOneOf_Field1:
n += proto.SizeVarint(1<<3 | proto.WireFixed64)
n += 8
case *AllTypesOneOf_Field2:
n += proto.SizeVarint(2<<3 | proto.WireFixed32)
n += 4
case *AllTypesOneOf_Field3:
n += proto.SizeVarint(3<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Field3))
case *AllTypesOneOf_Field4:
n += proto.SizeVarint(4<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Field4))
case *AllTypesOneOf_Field5:
n += proto.SizeVarint(5<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Field5))
case *AllTypesOneOf_Field6:
n += proto.SizeVarint(6<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Field6))
case *AllTypesOneOf_Field7:
n += proto.SizeVarint(7<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64((uint32(x.Field7) << 1) ^ uint32((int32(x.Field7) >> 31))))
case *AllTypesOneOf_Field8:
n += proto.SizeVarint(8<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(uint64(x.Field8<<1) ^ uint64((int64(x.Field8) >> 63))))
case *AllTypesOneOf_Field9:
n += proto.SizeVarint(9<<3 | proto.WireFixed32)
n += 4
case *AllTypesOneOf_Field10:
n += proto.SizeVarint(10<<3 | proto.WireFixed32)
n += 4
case *AllTypesOneOf_Field11:
n += proto.SizeVarint(11<<3 | proto.WireFixed64)
n += 8
case *AllTypesOneOf_Field12:
n += proto.SizeVarint(12<<3 | proto.WireFixed64)
n += 8
case *AllTypesOneOf_Field13:
n += proto.SizeVarint(13<<3 | proto.WireVarint)
n += 1
case *AllTypesOneOf_Field14:
n += proto.SizeVarint(14<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Field14)))
n += len(x.Field14)
case *AllTypesOneOf_Field15:
n += proto.SizeVarint(15<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Field15)))
n += len(x.Field15)
case *AllTypesOneOf_SubMessage:
s := proto.Size(x.SubMessage)
n += proto.SizeVarint(16<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type TwoOneofs struct {
// Types that are valid to be assigned to One:
// *TwoOneofs_Field1
// *TwoOneofs_Field2
// *TwoOneofs_Field3
One isTwoOneofs_One `protobuf_oneof:"one"`
// Types that are valid to be assigned to Two:
// *TwoOneofs_Field34
// *TwoOneofs_Field35
// *TwoOneofs_SubMessage2
Two isTwoOneofs_Two `protobuf_oneof:"two"`
XXX_unrecognized []byte `json:"-"`
}
func (m *TwoOneofs) Reset() { *m = TwoOneofs{} }
func (*TwoOneofs) ProtoMessage() {}
func (*TwoOneofs) Descriptor() ([]byte, []int) { return fileDescriptorOne, []int{2} }
type isTwoOneofs_One interface {
isTwoOneofs_One()
Equal(interface{}) bool
VerboseEqual(interface{}) error
Size() int
}
type isTwoOneofs_Two interface {
isTwoOneofs_Two()
Equal(interface{}) bool
VerboseEqual(interface{}) error
Size() int
}
type TwoOneofs_Field1 struct {
Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"`
}
type TwoOneofs_Field2 struct {
Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"`
}
type TwoOneofs_Field3 struct {
Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"`
}
type TwoOneofs_Field34 struct {
Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof"`
}
type TwoOneofs_Field35 struct {
Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof"`
}
type TwoOneofs_SubMessage2 struct {
SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof"`
}
func (*TwoOneofs_Field1) isTwoOneofs_One() {}
func (*TwoOneofs_Field2) isTwoOneofs_One() {}
func (*TwoOneofs_Field3) isTwoOneofs_One() {}
func (*TwoOneofs_Field34) isTwoOneofs_Two() {}
func (*TwoOneofs_Field35) isTwoOneofs_Two() {}
func (*TwoOneofs_SubMessage2) isTwoOneofs_Two() {}
func (m *TwoOneofs) GetOne() isTwoOneofs_One {
if m != nil {
return m.One
}
return nil
}
func (m *TwoOneofs) GetTwo() isTwoOneofs_Two {
if m != nil {
return m.Two
}
return nil
}
func (m *TwoOneofs) GetField1() float64 {
if x, ok := m.GetOne().(*TwoOneofs_Field1); ok {
return x.Field1
}
return 0
}
func (m *TwoOneofs) GetField2() float32 {
if x, ok := m.GetOne().(*TwoOneofs_Field2); ok {
return x.Field2
}
return 0
}
func (m *TwoOneofs) GetField3() int32 {
if x, ok := m.GetOne().(*TwoOneofs_Field3); ok {
return x.Field3
}
return 0
}
func (m *TwoOneofs) GetField34() string {
if x, ok := m.GetTwo().(*TwoOneofs_Field34); ok {
return x.Field34
}
return ""
}
func (m *TwoOneofs) GetField35() []byte {
if x, ok := m.GetTwo().(*TwoOneofs_Field35); ok {
return x.Field35
}
return nil
}
func (m *TwoOneofs) GetSubMessage2() *Subby {
if x, ok := m.GetTwo().(*TwoOneofs_SubMessage2); ok {
return x.SubMessage2
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{
(*TwoOneofs_Field1)(nil),
(*TwoOneofs_Field2)(nil),
(*TwoOneofs_Field3)(nil),
(*TwoOneofs_Field34)(nil),
(*TwoOneofs_Field35)(nil),
(*TwoOneofs_SubMessage2)(nil),
}
}
func _TwoOneofs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*TwoOneofs)
// one
switch x := m.One.(type) {
case *TwoOneofs_Field1:
_ = b.EncodeVarint(1<<3 | proto.WireFixed64)
_ = b.EncodeFixed64(math.Float64bits(x.Field1))
case *TwoOneofs_Field2:
_ = b.EncodeVarint(2<<3 | proto.WireFixed32)
_ = b.EncodeFixed32(uint64(math.Float32bits(x.Field2)))
case *TwoOneofs_Field3:
_ = b.EncodeVarint(3<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.Field3))
case nil:
default:
return fmt.Errorf("TwoOneofs.One has unexpected type %T", x)
}
// two
switch x := m.Two.(type) {
case *TwoOneofs_Field34:
_ = b.EncodeVarint(34<<3 | proto.WireBytes)
_ = b.EncodeStringBytes(x.Field34)
case *TwoOneofs_Field35:
_ = b.EncodeVarint(35<<3 | proto.WireBytes)
_ = b.EncodeRawBytes(x.Field35)
case *TwoOneofs_SubMessage2:
_ = b.EncodeVarint(36<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.SubMessage2); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("TwoOneofs.Two has unexpected type %T", x)
}
return nil
}
func _TwoOneofs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*TwoOneofs)
switch tag {
case 1: // one.Field1
if wire != proto.WireFixed64 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed64()
m.One = &TwoOneofs_Field1{math.Float64frombits(x)}
return true, err
case 2: // one.Field2
if wire != proto.WireFixed32 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed32()
m.One = &TwoOneofs_Field2{math.Float32frombits(uint32(x))}
return true, err
case 3: // one.Field3
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.One = &TwoOneofs_Field3{int32(x)}
return true, err
case 34: // two.Field34
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.Two = &TwoOneofs_Field34{x}
return true, err
case 35: // two.Field35
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeRawBytes(true)
m.Two = &TwoOneofs_Field35{x}
return true, err
case 36: // two.sub_message2
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(Subby)
err := b.DecodeMessage(msg)
m.Two = &TwoOneofs_SubMessage2{msg}
return true, err
default:
return false, nil
}
}
func _TwoOneofs_OneofSizer(msg proto.Message) (n int) {
m := msg.(*TwoOneofs)
// one
switch x := m.One.(type) {
case *TwoOneofs_Field1:
n += proto.SizeVarint(1<<3 | proto.WireFixed64)
n += 8
case *TwoOneofs_Field2:
n += proto.SizeVarint(2<<3 | proto.WireFixed32)
n += 4
case *TwoOneofs_Field3:
n += proto.SizeVarint(3<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Field3))
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
// two
switch x := m.Two.(type) {
case *TwoOneofs_Field34:
n += proto.SizeVarint(34<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Field34)))
n += len(x.Field34)
case *TwoOneofs_Field35:
n += proto.SizeVarint(35<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Field35)))
n += len(x.Field35)
case *TwoOneofs_SubMessage2:
s := proto.Size(x.SubMessage2)
n += proto.SizeVarint(36<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type CustomOneof struct {
// Types that are valid to be assigned to Custom:
// *CustomOneof_Stringy
// *CustomOneof_CustomType
// *CustomOneof_CastType
// *CustomOneof_MyCustomName
Custom isCustomOneof_Custom `protobuf_oneof:"custom"`
XXX_unrecognized []byte `json:"-"`
}
func (m *CustomOneof) Reset() { *m = CustomOneof{} }
func (*CustomOneof) ProtoMessage() {}
func (*CustomOneof) Descriptor() ([]byte, []int) { return fileDescriptorOne, []int{3} }
type isCustomOneof_Custom interface {
isCustomOneof_Custom()
Equal(interface{}) bool
VerboseEqual(interface{}) error
Size() int
}
type CustomOneof_Stringy struct {
Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof"`
}
type CustomOneof_CustomType struct {
CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128"`
}
type CustomOneof_CastType struct {
CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type"`
}
type CustomOneof_MyCustomName struct {
MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof"`
}
func (*CustomOneof_Stringy) isCustomOneof_Custom() {}
func (*CustomOneof_CustomType) isCustomOneof_Custom() {}
func (*CustomOneof_CastType) isCustomOneof_Custom() {}
func (*CustomOneof_MyCustomName) isCustomOneof_Custom() {}
func (m *CustomOneof) GetCustom() isCustomOneof_Custom {
if m != nil {
return m.Custom
}
return nil
}
func (m *CustomOneof) GetStringy() string {
if x, ok := m.GetCustom().(*CustomOneof_Stringy); ok {
return x.Stringy
}
return ""
}
func (m *CustomOneof) GetCastType() github_com_gogo_protobuf_test_casttype.MyUint64Type {
if x, ok := m.GetCustom().(*CustomOneof_CastType); ok {
return x.CastType
}
return 0
}
func (m *CustomOneof) GetMyCustomName() int64 {
if x, ok := m.GetCustom().(*CustomOneof_MyCustomName); ok {
return x.MyCustomName
}
return 0
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*CustomOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _CustomOneof_OneofMarshaler, _CustomOneof_OneofUnmarshaler, _CustomOneof_OneofSizer, []interface{}{
(*CustomOneof_Stringy)(nil),
(*CustomOneof_CustomType)(nil),
(*CustomOneof_CastType)(nil),
(*CustomOneof_MyCustomName)(nil),
}
}
func _CustomOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*CustomOneof)
// custom
switch x := m.Custom.(type) {
case *CustomOneof_Stringy:
_ = b.EncodeVarint(34<<3 | proto.WireBytes)
_ = b.EncodeStringBytes(x.Stringy)
case *CustomOneof_CustomType:
_ = b.EncodeVarint(35<<3 | proto.WireBytes)
dAtA, err := x.CustomType.Marshal()
if err != nil {
return err
}
_ = b.EncodeRawBytes(dAtA)
case *CustomOneof_CastType:
_ = b.EncodeVarint(36<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.CastType))
case *CustomOneof_MyCustomName:
_ = b.EncodeVarint(37<<3 | proto.WireVarint)
_ = b.EncodeVarint(uint64(x.MyCustomName))
case nil:
default:
return fmt.Errorf("CustomOneof.Custom has unexpected type %T", x)
}
return nil
}
func _CustomOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*CustomOneof)
switch tag {
case 34: // custom.Stringy
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.Custom = &CustomOneof_Stringy{x}
return true, err
case 35: // custom.CustomType
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeRawBytes(true)
if err != nil {
return true, err
}
var cc github_com_gogo_protobuf_test_custom.Uint128
c := &cc
err = c.Unmarshal(x)
m.Custom = &CustomOneof_CustomType{*c}
return true, err
case 36: // custom.CastType
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Custom = &CustomOneof_CastType{github_com_gogo_protobuf_test_casttype.MyUint64Type(x)}
return true, err
case 37: // custom.CustomName
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Custom = &CustomOneof_MyCustomName{int64(x)}
return true, err
default:
return false, nil
}
}
func _CustomOneof_OneofSizer(msg proto.Message) (n int) {
m := msg.(*CustomOneof)
// custom
switch x := m.Custom.(type) {
case *CustomOneof_Stringy:
n += proto.SizeVarint(34<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Stringy)))
n += len(x.Stringy)
case *CustomOneof_CustomType:
n += proto.SizeVarint(35<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(x.CustomType.Size()))
n += x.CustomType.Size()
case *CustomOneof_CastType:
n += proto.SizeVarint(36<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.CastType))
case *CustomOneof_MyCustomName:
n += proto.SizeVarint(37<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.MyCustomName))
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
func init() {
proto.RegisterType((*Subby)(nil), "one.Subby")
proto.RegisterType((*AllTypesOneOf)(nil), "one.AllTypesOneOf")
proto.RegisterType((*TwoOneofs)(nil), "one.TwoOneofs")
proto.RegisterType((*CustomOneof)(nil), "one.CustomOneof")
}
func (this *Subby) Description() (desc *descriptor.FileDescriptorSet) {
return OneDescription()
}
func (this *AllTypesOneOf) Description() (desc *descriptor.FileDescriptorSet) {
return OneDescription()
}
func (this *TwoOneofs) Description() (desc *descriptor.FileDescriptorSet) {
return OneDescription()
}
func (this *CustomOneof) Description() (desc *descriptor.FileDescriptorSet) {
return OneDescription()
}
func OneDescription() (desc *descriptor.FileDescriptorSet) {
d := &descriptor.FileDescriptorSet{}
var gzipped = []byte{
// 4154 bytes of a gzipped FileDescriptorSet
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x7a, 0x6b, 0x6c, 0x1c, 0xd7,
0x75, 0x3f, 0x67, 0x1f, 0xe4, 0xee, 0xd9, 0xe5, 0x72, 0x78, 0x49, 0x4b, 0x2b, 0xda, 0x5e, 0x49,
0x6b, 0x3b, 0xa2, 0xed, 0x98, 0xb4, 0x29, 0x52, 0x8f, 0xd5, 0x3f, 0xf1, 0x7f, 0x49, 0xae, 0x28,
0xaa, 0x24, 0x97, 0x19, 0x92, 0xf1, 0x23, 0x28, 0x06, 0xc3, 0xd9, 0xcb, 0xe5, 0x48, 0xb3, 0x33,
0x93, 0x99, 0x59, 0xc9, 0x14, 0xfa, 0x41, 0x85, 0xfb, 0x40, 0x50, 0xf4, 0x95, 0x16, 0x48, 0xe2,
0x3a, 0xee, 0x03, 0x68, 0x9d, 0xa6, 0xaf, 0xa4, 0x69, 0xd3, 0xb4, 0x9f, 0xfa, 0x25, 0xad, 0x3f,
0x15, 0xce, 0xb7, 0xa2, 0x28, 0x0c, 0x8b, 0x31, 0xd0, 0xb4, 0x75, 0x1b, 0xb7, 0xf5, 0x07, 0xa3,
0xee, 0x87, 0xe2, 0xbe, 0x66, 0x66, 0x1f, 0xd4, 0x2c, 0x83, 0xda, 0xf9, 0x44, 0xce, 0x39, 0xe7,
0xf7, 0x9b, 0x73, 0xcf, 0x3d, 0xf7, 0x9c, 0x7b, 0xef, 0x0e, 0xfc, 0xf0, 0x32, 0x9c, 0x69, 0xda,
0x76, 0xd3, 0xc4, 0xb3, 0x8e, 0x6b, 0xfb, 0xf6, 0x6e, 0x7b, 0x6f, 0xb6, 0x81, 0x3d, 0xdd, 0x35,
0x1c, 0xdf, 0x76, 0x67, 0xa8, 0x0c, 0x8d, 0x31, 0x8b, 0x19, 0x61, 0x51, 0x5e, 0x87, 0xf1, 0xab,