oneofembed.pb.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: oneofembed.proto
  3. /*
  4. Package proto is a generated protocol buffer package.
  5. It is generated from these files:
  6. oneofembed.proto
  7. It has these top-level messages:
  8. Foo
  9. Bar
  10. */
  11. package proto
  12. import proto1 "github.com/gogo/protobuf/proto"
  13. import fmt "fmt"
  14. import math "math"
  15. import _ "github.com/gogo/protobuf/gogoproto"
  16. // Reference imports to suppress errors if they are not otherwise used.
  17. var _ = proto1.Marshal
  18. var _ = fmt.Errorf
  19. var _ = math.Inf
  20. // This is a compile-time assertion to ensure that this generated file
  21. // is compatible with the proto package it is being compiled against.
  22. // A compilation error at this line likely means your copy of the
  23. // proto package needs to be updated.
  24. const _ = proto1.GoGoProtoPackageIsVersion2 // please upgrade the proto package
  25. type Foo struct {
  26. *Bar `protobuf:"bytes,1,opt,name=bar,embedded=bar" json:"bar,omitempty"`
  27. }
  28. func (m *Foo) Reset() { *m = Foo{} }
  29. func (m *Foo) String() string { return proto1.CompactTextString(m) }
  30. func (*Foo) ProtoMessage() {}
  31. func (*Foo) Descriptor() ([]byte, []int) { return fileDescriptorOneofembed, []int{0} }
  32. type Bar struct {
  33. // Types that are valid to be assigned to Pick:
  34. // *Bar_A
  35. // *Bar_B
  36. Pick isBar_Pick `protobuf_oneof:"pick"`
  37. }
  38. func (m *Bar) Reset() { *m = Bar{} }
  39. func (m *Bar) String() string { return proto1.CompactTextString(m) }
  40. func (*Bar) ProtoMessage() {}
  41. func (*Bar) Descriptor() ([]byte, []int) { return fileDescriptorOneofembed, []int{1} }
  42. type isBar_Pick interface {
  43. isBar_Pick()
  44. Equal(interface{}) bool
  45. }
  46. type Bar_A struct {
  47. A bool `protobuf:"varint,11,opt,name=a,proto3,oneof"`
  48. }
  49. type Bar_B struct {
  50. B bool `protobuf:"varint,12,opt,name=b,proto3,oneof"`
  51. }
  52. func (*Bar_A) isBar_Pick() {}
  53. func (*Bar_B) isBar_Pick() {}
  54. func (m *Bar) GetPick() isBar_Pick {
  55. if m != nil {
  56. return m.Pick
  57. }
  58. return nil
  59. }
  60. func (m *Bar) GetA() bool {
  61. if x, ok := m.GetPick().(*Bar_A); ok {
  62. return x.A
  63. }
  64. return false
  65. }
  66. func (m *Bar) GetB() bool {
  67. if x, ok := m.GetPick().(*Bar_B); ok {
  68. return x.B
  69. }
  70. return false
  71. }
  72. // XXX_OneofFuncs is for the internal use of the proto package.
  73. func (*Bar) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {
  74. return _Bar_OneofMarshaler, _Bar_OneofUnmarshaler, _Bar_OneofSizer, []interface{}{
  75. (*Bar_A)(nil),
  76. (*Bar_B)(nil),
  77. }
  78. }
  79. func _Bar_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error {
  80. m := msg.(*Bar)
  81. // pick
  82. switch x := m.Pick.(type) {
  83. case *Bar_A:
  84. t := uint64(0)
  85. if x.A {
  86. t = 1
  87. }
  88. _ = b.EncodeVarint(11<<3 | proto1.WireVarint)
  89. _ = b.EncodeVarint(t)
  90. case *Bar_B:
  91. t := uint64(0)
  92. if x.B {
  93. t = 1
  94. }
  95. _ = b.EncodeVarint(12<<3 | proto1.WireVarint)
  96. _ = b.EncodeVarint(t)
  97. case nil:
  98. default:
  99. return fmt.Errorf("Bar.Pick has unexpected type %T", x)
  100. }
  101. return nil
  102. }
  103. func _Bar_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) {
  104. m := msg.(*Bar)
  105. switch tag {
  106. case 11: // pick.a
  107. if wire != proto1.WireVarint {
  108. return true, proto1.ErrInternalBadWireType
  109. }
  110. x, err := b.DecodeVarint()
  111. m.Pick = &Bar_A{x != 0}
  112. return true, err
  113. case 12: // pick.b
  114. if wire != proto1.WireVarint {
  115. return true, proto1.ErrInternalBadWireType
  116. }
  117. x, err := b.DecodeVarint()
  118. m.Pick = &Bar_B{x != 0}
  119. return true, err
  120. default:
  121. return false, nil
  122. }
  123. }
  124. func _Bar_OneofSizer(msg proto1.Message) (n int) {
  125. m := msg.(*Bar)
  126. // pick
  127. switch x := m.Pick.(type) {
  128. case *Bar_A:
  129. n += proto1.SizeVarint(11<<3 | proto1.WireVarint)
  130. n += 1
  131. case *Bar_B:
  132. n += proto1.SizeVarint(12<<3 | proto1.WireVarint)
  133. n += 1
  134. case nil:
  135. default:
  136. panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
  137. }
  138. return n
  139. }
  140. func init() {
  141. proto1.RegisterType((*Foo)(nil), "proto.Foo")
  142. proto1.RegisterType((*Bar)(nil), "proto.Bar")
  143. }
  144. func (this *Foo) Equal(that interface{}) bool {
  145. if that == nil {
  146. if this == nil {
  147. return true
  148. }
  149. return false
  150. }
  151. that1, ok := that.(*Foo)
  152. if !ok {
  153. that2, ok := that.(Foo)
  154. if ok {
  155. that1 = &that2
  156. } else {
  157. return false
  158. }
  159. }
  160. if that1 == nil {
  161. if this == nil {
  162. return true
  163. }
  164. return false
  165. } else if this == nil {
  166. return false
  167. }
  168. if !this.Bar.Equal(that1.Bar) {
  169. return false
  170. }
  171. return true
  172. }
  173. func (this *Bar) Equal(that interface{}) bool {
  174. if that == nil {
  175. if this == nil {
  176. return true
  177. }
  178. return false
  179. }
  180. that1, ok := that.(*Bar)
  181. if !ok {
  182. that2, ok := that.(Bar)
  183. if ok {
  184. that1 = &that2
  185. } else {
  186. return false
  187. }
  188. }
  189. if that1 == nil {
  190. if this == nil {
  191. return true
  192. }
  193. return false
  194. } else if this == nil {
  195. return false
  196. }
  197. if that1.Pick == nil {
  198. if this.Pick != nil {
  199. return false
  200. }
  201. } else if this.Pick == nil {
  202. return false
  203. } else if !this.Pick.Equal(that1.Pick) {
  204. return false
  205. }
  206. return true
  207. }
  208. func (this *Bar_A) Equal(that interface{}) bool {
  209. if that == nil {
  210. if this == nil {
  211. return true
  212. }
  213. return false
  214. }
  215. that1, ok := that.(*Bar_A)
  216. if !ok {
  217. that2, ok := that.(Bar_A)
  218. if ok {
  219. that1 = &that2
  220. } else {
  221. return false
  222. }
  223. }
  224. if that1 == nil {
  225. if this == nil {
  226. return true
  227. }
  228. return false
  229. } else if this == nil {
  230. return false
  231. }
  232. if this.A != that1.A {
  233. return false
  234. }
  235. return true
  236. }
  237. func (this *Bar_B) Equal(that interface{}) bool {
  238. if that == nil {
  239. if this == nil {
  240. return true
  241. }
  242. return false
  243. }
  244. that1, ok := that.(*Bar_B)
  245. if !ok {
  246. that2, ok := that.(Bar_B)
  247. if ok {
  248. that1 = &that2
  249. } else {
  250. return false
  251. }
  252. }
  253. if that1 == nil {
  254. if this == nil {
  255. return true
  256. }
  257. return false
  258. } else if this == nil {
  259. return false
  260. }
  261. if this.B != that1.B {
  262. return false
  263. }
  264. return true
  265. }
  266. func NewPopulatedFoo(r randyOneofembed, easy bool) *Foo {
  267. this := &Foo{}
  268. if r.Intn(10) != 0 {
  269. this.Bar = NewPopulatedBar(r, easy)
  270. }
  271. if !easy && r.Intn(10) != 0 {
  272. }
  273. return this
  274. }
  275. func NewPopulatedBar(r randyOneofembed, easy bool) *Bar {
  276. this := &Bar{}
  277. oneofNumber_Pick := []int32{11, 12}[r.Intn(2)]
  278. switch oneofNumber_Pick {
  279. case 11:
  280. this.Pick = NewPopulatedBar_A(r, easy)
  281. case 12:
  282. this.Pick = NewPopulatedBar_B(r, easy)
  283. }
  284. if !easy && r.Intn(10) != 0 {
  285. }
  286. return this
  287. }
  288. func NewPopulatedBar_A(r randyOneofembed, easy bool) *Bar_A {
  289. this := &Bar_A{}
  290. this.A = bool(bool(r.Intn(2) == 0))
  291. return this
  292. }
  293. func NewPopulatedBar_B(r randyOneofembed, easy bool) *Bar_B {
  294. this := &Bar_B{}
  295. this.B = bool(bool(r.Intn(2) == 0))
  296. return this
  297. }
  298. type randyOneofembed interface {
  299. Float32() float32
  300. Float64() float64
  301. Int63() int64
  302. Int31() int32
  303. Uint32() uint32
  304. Intn(n int) int
  305. }
  306. func randUTF8RuneOneofembed(r randyOneofembed) rune {
  307. ru := r.Intn(62)
  308. if ru < 10 {
  309. return rune(ru + 48)
  310. } else if ru < 36 {
  311. return rune(ru + 55)
  312. }
  313. return rune(ru + 61)
  314. }
  315. func randStringOneofembed(r randyOneofembed) string {
  316. v1 := r.Intn(100)
  317. tmps := make([]rune, v1)
  318. for i := 0; i < v1; i++ {
  319. tmps[i] = randUTF8RuneOneofembed(r)
  320. }
  321. return string(tmps)
  322. }
  323. func randUnrecognizedOneofembed(r randyOneofembed, maxFieldNumber int) (dAtA []byte) {
  324. l := r.Intn(5)
  325. for i := 0; i < l; i++ {
  326. wire := r.Intn(4)
  327. if wire == 3 {
  328. wire = 5
  329. }
  330. fieldNumber := maxFieldNumber + r.Intn(100)
  331. dAtA = randFieldOneofembed(dAtA, r, fieldNumber, wire)
  332. }
  333. return dAtA
  334. }
  335. func randFieldOneofembed(dAtA []byte, r randyOneofembed, fieldNumber int, wire int) []byte {
  336. key := uint32(fieldNumber)<<3 | uint32(wire)
  337. switch wire {
  338. case 0:
  339. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(key))
  340. v2 := r.Int63()
  341. if r.Intn(2) == 0 {
  342. v2 *= -1
  343. }
  344. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(v2))
  345. case 1:
  346. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(key))
  347. dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  348. case 2:
  349. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(key))
  350. ll := r.Intn(100)
  351. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(ll))
  352. for j := 0; j < ll; j++ {
  353. dAtA = append(dAtA, byte(r.Intn(256)))
  354. }
  355. default:
  356. dAtA = encodeVarintPopulateOneofembed(dAtA, uint64(key))
  357. dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  358. }
  359. return dAtA
  360. }
  361. func encodeVarintPopulateOneofembed(dAtA []byte, v uint64) []byte {
  362. for v >= 1<<7 {
  363. dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
  364. v >>= 7
  365. }
  366. dAtA = append(dAtA, uint8(v))
  367. return dAtA
  368. }
  369. func init() { proto1.RegisterFile("oneofembed.proto", fileDescriptorOneofembed) }
  370. var fileDescriptorOneofembed = []byte{
  371. // 171 bytes of a gzipped FileDescriptorProto
  372. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0xcf, 0x4b, 0xcd,
  373. 0x4f, 0x4b, 0xcd, 0x4d, 0x4a, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53,
  374. 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9,
  375. 0xf9, 0xfa, 0x60, 0xe1, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20, 0xba, 0x94, 0x34,
  376. 0xb9, 0x98, 0xdd, 0xf2, 0xf3, 0x85, 0x94, 0xb8, 0x98, 0x93, 0x12, 0x8b, 0x24, 0x18, 0x15, 0x18,
  377. 0x35, 0xb8, 0x8d, 0xb8, 0x20, 0x72, 0x7a, 0x4e, 0x89, 0x45, 0x4e, 0x2c, 0x17, 0xee, 0xc9, 0x33,
  378. 0x06, 0x81, 0x24, 0x95, 0x74, 0xb9, 0x98, 0x9d, 0x12, 0x8b, 0x84, 0xf8, 0xb8, 0x18, 0x13, 0x25,
  379. 0xb8, 0x15, 0x18, 0x35, 0x38, 0x3c, 0x18, 0x82, 0x18, 0x13, 0x41, 0xfc, 0x24, 0x09, 0x1e, 0x18,
  380. 0x3f, 0xc9, 0x89, 0x8d, 0x8b, 0xa5, 0x20, 0x33, 0x39, 0xdb, 0x89, 0xe7, 0xc7, 0x43, 0x39, 0xc6,
  381. 0x15, 0x8f, 0xe4, 0x18, 0x77, 0x3c, 0x92, 0x63, 0x4c, 0x62, 0x03, 0x1b, 0x69, 0x0c, 0x08, 0x00,
  382. 0x00, 0xff, 0xff, 0x56, 0x58, 0x05, 0x27, 0xb8, 0x00, 0x00, 0x00,
  383. }