1// Autogenerated by Thrift Compiler (facebook)
2// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3// @generated
4
5package module1
6
7import (
8	"bytes"
9	"context"
10	"sync"
11	"fmt"
12	thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift"
13	module00 "module0"
14
15)
16
17// (needed to ensure safety because of naive import list construction.)
18var _ = thrift.ZERO
19var _ = fmt.Printf
20var _ = sync.Mutex{}
21var _ = bytes.Equal
22var _ = context.Background
23
24var _ = module00.GoUnusedProtection__
25var GoUnusedProtection__ int;
26
27type Plate = string
28
29func PlatePtr(v Plate) *Plate { return &v }
30
31type State = string
32
33func StatePtr(v State) *State { return &v }
34
35type Year = int32
36
37func YearPtr(v Year) *Year { return &v }
38
39type Drivers = []string
40
41func DriversPtr(v Drivers) *Drivers { return &v }
42
43type Accessory = module00.Accessory
44
45func AccessoryPtr(v Accessory) *Accessory { return &v }
46
47func NewAccessory() *Accessory { return module00.NewAccessory() }
48
49type PartName = module00.PartName
50
51func PartNamePtr(v PartName) *PartName { return &v }
52
53func NewPartName() *PartName { return module00.NewPartName() }
54
55type Car = Automobile
56
57func CarPtr(v Car) *Car { return &v }
58
59func NewCar() *Car { return NewAutomobile() }
60
61// Attributes:
62//  - Plate
63//  - PreviousPlate
64//  - FirstPlate
65//  - Year
66//  - Drivers
67//  - Accessories
68//  - PartNames
69type Automobile struct {
70  Plate Plate `thrift:"plate,1" db:"plate" json:"plate"`
71  PreviousPlate *Plate `thrift:"previous_plate,2,optional" db:"previous_plate" json:"previous_plate,omitempty"`
72  FirstPlate Plate `thrift:"first_plate,3,optional" db:"first_plate" json:"first_plate,omitempty"`
73  Year Year `thrift:"year,4" db:"year" json:"year"`
74  Drivers Drivers `thrift:"drivers,5" db:"drivers" json:"drivers"`
75  Accessories []*Accessory `thrift:"Accessories,6" db:"Accessories" json:"Accessories"`
76  PartNames map[int32]*PartName `thrift:"PartNames,7" db:"PartNames" json:"PartNames"`
77}
78
79func NewAutomobile() *Automobile {
80  return &Automobile{
81    FirstPlate: "0000",
82  }
83}
84
85
86func (p *Automobile) GetPlate() Plate {
87  return p.Plate
88}
89var Automobile_PreviousPlate_DEFAULT Plate
90func (p *Automobile) GetPreviousPlate() Plate {
91  if !p.IsSetPreviousPlate() {
92    return Automobile_PreviousPlate_DEFAULT
93  }
94return *p.PreviousPlate
95}
96var Automobile_FirstPlate_DEFAULT Plate = "0000"
97
98func (p *Automobile) GetFirstPlate() Plate {
99  return p.FirstPlate
100}
101
102func (p *Automobile) GetYear() Year {
103  return p.Year
104}
105
106func (p *Automobile) GetDrivers() Drivers {
107  return p.Drivers
108}
109
110func (p *Automobile) GetAccessories() []*Accessory {
111  return p.Accessories
112}
113
114func (p *Automobile) GetPartNames() map[int32]*PartName {
115  return p.PartNames
116}
117func (p *Automobile) IsSetPreviousPlate() bool {
118  return p != nil && p.PreviousPlate != nil
119}
120
121func (p *Automobile) IsSetFirstPlate() bool {
122  return p != nil && p.FirstPlate != Automobile_FirstPlate_DEFAULT
123}
124
125type AutomobileBuilder struct {
126  obj *Automobile
127}
128
129func NewAutomobileBuilder() *AutomobileBuilder{
130  return &AutomobileBuilder{
131    obj: NewAutomobile(),
132  }
133}
134
135func (p AutomobileBuilder) Emit() *Automobile{
136  return &Automobile{
137    Plate: p.obj.Plate,
138    PreviousPlate: p.obj.PreviousPlate,
139    FirstPlate: p.obj.FirstPlate,
140    Year: p.obj.Year,
141    Drivers: p.obj.Drivers,
142    Accessories: p.obj.Accessories,
143    PartNames: p.obj.PartNames,
144  }
145}
146
147func (a *AutomobileBuilder) Plate(plate Plate) *AutomobileBuilder {
148  a.obj.Plate = plate
149  return a
150}
151
152func (a *AutomobileBuilder) PreviousPlate(previousPlate *Plate) *AutomobileBuilder {
153  a.obj.PreviousPlate = previousPlate
154  return a
155}
156
157func (a *AutomobileBuilder) FirstPlate(firstPlate Plate) *AutomobileBuilder {
158  a.obj.FirstPlate = firstPlate
159  return a
160}
161
162func (a *AutomobileBuilder) Year(year Year) *AutomobileBuilder {
163  a.obj.Year = year
164  return a
165}
166
167func (a *AutomobileBuilder) Drivers(drivers Drivers) *AutomobileBuilder {
168  a.obj.Drivers = drivers
169  return a
170}
171
172func (a *AutomobileBuilder) Accessories(accessories []*Accessory) *AutomobileBuilder {
173  a.obj.Accessories = accessories
174  return a
175}
176
177func (a *AutomobileBuilder) PartNames(partNames map[int32]*PartName) *AutomobileBuilder {
178  a.obj.PartNames = partNames
179  return a
180}
181
182func (a *Automobile) SetPlate(plate Plate) *Automobile {
183  a.Plate = plate
184  return a
185}
186
187func (a *Automobile) SetPreviousPlate(previousPlate *Plate) *Automobile {
188  a.PreviousPlate = previousPlate
189  return a
190}
191
192func (a *Automobile) SetFirstPlate(firstPlate Plate) *Automobile {
193  a.FirstPlate = firstPlate
194  return a
195}
196
197func (a *Automobile) SetYear(year Year) *Automobile {
198  a.Year = year
199  return a
200}
201
202func (a *Automobile) SetDrivers(drivers Drivers) *Automobile {
203  a.Drivers = drivers
204  return a
205}
206
207func (a *Automobile) SetAccessories(accessories []*Accessory) *Automobile {
208  a.Accessories = accessories
209  return a
210}
211
212func (a *Automobile) SetPartNames(partNames map[int32]*PartName) *Automobile {
213  a.PartNames = partNames
214  return a
215}
216
217func (p *Automobile) Read(iprot thrift.Protocol) error {
218  if _, err := iprot.ReadStructBegin(); err != nil {
219    return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
220  }
221
222
223  for {
224    _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
225    if err != nil {
226      return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
227    }
228    if fieldTypeId == thrift.STOP { break; }
229    switch fieldId {
230    case 1:
231      if err := p.ReadField1(iprot); err != nil {
232        return err
233      }
234    case 2:
235      if err := p.ReadField2(iprot); err != nil {
236        return err
237      }
238    case 3:
239      if err := p.ReadField3(iprot); err != nil {
240        return err
241      }
242    case 4:
243      if err := p.ReadField4(iprot); err != nil {
244        return err
245      }
246    case 5:
247      if err := p.ReadField5(iprot); err != nil {
248        return err
249      }
250    case 6:
251      if err := p.ReadField6(iprot); err != nil {
252        return err
253      }
254    case 7:
255      if err := p.ReadField7(iprot); err != nil {
256        return err
257      }
258    default:
259      if err := iprot.Skip(fieldTypeId); err != nil {
260        return err
261      }
262    }
263    if err := iprot.ReadFieldEnd(); err != nil {
264      return err
265    }
266  }
267  if err := iprot.ReadStructEnd(); err != nil {
268    return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
269  }
270  return nil
271}
272
273func (p *Automobile)  ReadField1(iprot thrift.Protocol) error {
274  if v, err := iprot.ReadString(); err != nil {
275    return thrift.PrependError("error reading field 1: ", err)
276  } else {
277    temp := Plate(v)
278    p.Plate = temp
279  }
280  return nil
281}
282
283func (p *Automobile)  ReadField2(iprot thrift.Protocol) error {
284  if v, err := iprot.ReadString(); err != nil {
285    return thrift.PrependError("error reading field 2: ", err)
286  } else {
287    temp := Plate(v)
288    p.PreviousPlate = &temp
289  }
290  return nil
291}
292
293func (p *Automobile)  ReadField3(iprot thrift.Protocol) error {
294  if v, err := iprot.ReadString(); err != nil {
295    return thrift.PrependError("error reading field 3: ", err)
296  } else {
297    temp := Plate(v)
298    p.FirstPlate = temp
299  }
300  return nil
301}
302
303func (p *Automobile)  ReadField4(iprot thrift.Protocol) error {
304  if v, err := iprot.ReadI32(); err != nil {
305    return thrift.PrependError("error reading field 4: ", err)
306  } else {
307    temp := Year(v)
308    p.Year = temp
309  }
310  return nil
311}
312
313func (p *Automobile)  ReadField5(iprot thrift.Protocol) error {
314  _, size, err := iprot.ReadListBegin()
315  if err != nil {
316    return thrift.PrependError("error reading list begin: ", err)
317  }
318  tSlice := make(Drivers, 0, size)
319  p.Drivers =  tSlice
320  for i := 0; i < size; i ++ {
321    var _elem1 string
322    if v, err := iprot.ReadString(); err != nil {
323      return thrift.PrependError("error reading field 0: ", err)
324    } else {
325      _elem1 = v
326    }
327    p.Drivers = append(p.Drivers, _elem1)
328  }
329  if err := iprot.ReadListEnd(); err != nil {
330    return thrift.PrependError("error reading list end: ", err)
331  }
332  return nil
333}
334
335func (p *Automobile)  ReadField6(iprot thrift.Protocol) error {
336  _, size, err := iprot.ReadListBegin()
337  if err != nil {
338    return thrift.PrependError("error reading list begin: ", err)
339  }
340  tSlice := make([]*Accessory, 0, size)
341  p.Accessories =  tSlice
342  for i := 0; i < size; i ++ {
343    _elem2 := NewAccessory()
344    if err := _elem2.Read(iprot); err != nil {
345      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err)
346    }
347    p.Accessories = append(p.Accessories, _elem2)
348  }
349  if err := iprot.ReadListEnd(); err != nil {
350    return thrift.PrependError("error reading list end: ", err)
351  }
352  return nil
353}
354
355func (p *Automobile)  ReadField7(iprot thrift.Protocol) error {
356  _, _, size, err := iprot.ReadMapBegin()
357  if err != nil {
358    return thrift.PrependError("error reading map begin: ", err)
359  }
360  tMap := make(map[int32]*PartName, size)
361  p.PartNames =  tMap
362  for i := 0; i < size; i ++ {
363    var _key3 int32
364    if v, err := iprot.ReadI32(); err != nil {
365      return thrift.PrependError("error reading field 0: ", err)
366    } else {
367      _key3 = v
368    }
369    _val4 := NewPartName()
370    if err := _val4.Read(iprot); err != nil {
371      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val4), err)
372    }
373    p.PartNames[_key3] = _val4
374  }
375  if err := iprot.ReadMapEnd(); err != nil {
376    return thrift.PrependError("error reading map end: ", err)
377  }
378  return nil
379}
380
381func (p *Automobile) Write(oprot thrift.Protocol) error {
382  if err := oprot.WriteStructBegin("Automobile"); err != nil {
383    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
384  if err := p.writeField1(oprot); err != nil { return err }
385  if err := p.writeField2(oprot); err != nil { return err }
386  if err := p.writeField3(oprot); err != nil { return err }
387  if err := p.writeField4(oprot); err != nil { return err }
388  if err := p.writeField5(oprot); err != nil { return err }
389  if err := p.writeField6(oprot); err != nil { return err }
390  if err := p.writeField7(oprot); err != nil { return err }
391  if err := oprot.WriteFieldStop(); err != nil {
392    return thrift.PrependError("write field stop error: ", err) }
393  if err := oprot.WriteStructEnd(); err != nil {
394    return thrift.PrependError("write struct stop error: ", err) }
395  return nil
396}
397
398func (p *Automobile) writeField1(oprot thrift.Protocol) (err error) {
399  if err := oprot.WriteFieldBegin("plate", thrift.STRING, 1); err != nil {
400    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:plate: ", p), err) }
401  if err := oprot.WriteString(string(p.Plate)); err != nil {
402  return thrift.PrependError(fmt.Sprintf("%T.plate (1) field write error: ", p), err) }
403  if err := oprot.WriteFieldEnd(); err != nil {
404    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:plate: ", p), err) }
405  return err
406}
407
408func (p *Automobile) writeField2(oprot thrift.Protocol) (err error) {
409  if p.IsSetPreviousPlate() {
410    if err := oprot.WriteFieldBegin("previous_plate", thrift.STRING, 2); err != nil {
411      return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:previous_plate: ", p), err) }
412    if err := oprot.WriteString(string(*p.PreviousPlate)); err != nil {
413    return thrift.PrependError(fmt.Sprintf("%T.previous_plate (2) field write error: ", p), err) }
414    if err := oprot.WriteFieldEnd(); err != nil {
415      return thrift.PrependError(fmt.Sprintf("%T write field end error 2:previous_plate: ", p), err) }
416  }
417  return err
418}
419
420func (p *Automobile) writeField3(oprot thrift.Protocol) (err error) {
421  if p.IsSetFirstPlate() {
422    if err := oprot.WriteFieldBegin("first_plate", thrift.STRING, 3); err != nil {
423      return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:first_plate: ", p), err) }
424    if err := oprot.WriteString(string(p.FirstPlate)); err != nil {
425    return thrift.PrependError(fmt.Sprintf("%T.first_plate (3) field write error: ", p), err) }
426    if err := oprot.WriteFieldEnd(); err != nil {
427      return thrift.PrependError(fmt.Sprintf("%T write field end error 3:first_plate: ", p), err) }
428  }
429  return err
430}
431
432func (p *Automobile) writeField4(oprot thrift.Protocol) (err error) {
433  if err := oprot.WriteFieldBegin("year", thrift.I32, 4); err != nil {
434    return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:year: ", p), err) }
435  if err := oprot.WriteI32(int32(p.Year)); err != nil {
436  return thrift.PrependError(fmt.Sprintf("%T.year (4) field write error: ", p), err) }
437  if err := oprot.WriteFieldEnd(); err != nil {
438    return thrift.PrependError(fmt.Sprintf("%T write field end error 4:year: ", p), err) }
439  return err
440}
441
442func (p *Automobile) writeField5(oprot thrift.Protocol) (err error) {
443  if err := oprot.WriteFieldBegin("drivers", thrift.LIST, 5); err != nil {
444    return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:drivers: ", p), err) }
445  if err := oprot.WriteListBegin(thrift.STRING, len(p.Drivers)); err != nil {
446    return thrift.PrependError("error writing list begin: ", err)
447  }
448  for _, v := range p.Drivers {
449    if err := oprot.WriteString(string(v)); err != nil {
450    return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) }
451  }
452  if err := oprot.WriteListEnd(); err != nil {
453    return thrift.PrependError("error writing list end: ", err)
454  }
455  if err := oprot.WriteFieldEnd(); err != nil {
456    return thrift.PrependError(fmt.Sprintf("%T write field end error 5:drivers: ", p), err) }
457  return err
458}
459
460func (p *Automobile) writeField6(oprot thrift.Protocol) (err error) {
461  if err := oprot.WriteFieldBegin("Accessories", thrift.LIST, 6); err != nil {
462    return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:Accessories: ", p), err) }
463  if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Accessories)); err != nil {
464    return thrift.PrependError("error writing list begin: ", err)
465  }
466  for _, v := range p.Accessories {
467    if err := v.Write(oprot); err != nil {
468      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
469    }
470  }
471  if err := oprot.WriteListEnd(); err != nil {
472    return thrift.PrependError("error writing list end: ", err)
473  }
474  if err := oprot.WriteFieldEnd(); err != nil {
475    return thrift.PrependError(fmt.Sprintf("%T write field end error 6:Accessories: ", p), err) }
476  return err
477}
478
479func (p *Automobile) writeField7(oprot thrift.Protocol) (err error) {
480  if err := oprot.WriteFieldBegin("PartNames", thrift.MAP, 7); err != nil {
481    return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:PartNames: ", p), err) }
482  if err := oprot.WriteMapBegin(thrift.I32, thrift.STRUCT, len(p.PartNames)); err != nil {
483    return thrift.PrependError("error writing map begin: ", err)
484  }
485  for k, v := range p.PartNames {
486    if err := oprot.WriteI32(int32(k)); err != nil {
487    return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) }
488    if err := v.Write(oprot); err != nil {
489      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
490    }
491  }
492  if err := oprot.WriteMapEnd(); err != nil {
493    return thrift.PrependError("error writing map end: ", err)
494  }
495  if err := oprot.WriteFieldEnd(); err != nil {
496    return thrift.PrependError(fmt.Sprintf("%T write field end error 7:PartNames: ", p), err) }
497  return err
498}
499
500func (p *Automobile) String() string {
501  if p == nil {
502    return "<nil>"
503  }
504
505  plateVal := fmt.Sprintf("%v", p.Plate)
506  var previousPlateVal string
507  if p.PreviousPlate == nil {
508    previousPlateVal = "<nil>"
509  } else {
510    previousPlateVal = fmt.Sprintf("%v", *p.PreviousPlate)
511  }
512  firstPlateVal := fmt.Sprintf("%v", p.FirstPlate)
513  yearVal := fmt.Sprintf("%v", p.Year)
514  driversVal := fmt.Sprintf("%v", p.Drivers)
515  accessoriesVal := fmt.Sprintf("%v", p.Accessories)
516  partNamesVal := fmt.Sprintf("%v", p.PartNames)
517  return fmt.Sprintf("Automobile({Plate:%s PreviousPlate:%s FirstPlate:%s Year:%s Drivers:%s Accessories:%s PartNames:%s})", plateVal, previousPlateVal, firstPlateVal, yearVal, driversVal, accessoriesVal, partNamesVal)
518}
519
520// Attributes:
521//  - Num
522//  - Strval
523type MapKey struct {
524  Num int64 `thrift:"num,1" db:"num" json:"num"`
525  Strval string `thrift:"strval,2" db:"strval" json:"strval"`
526}
527
528func NewMapKey() *MapKey {
529  return &MapKey{}
530}
531
532
533func (p *MapKey) GetNum() int64 {
534  return p.Num
535}
536
537func (p *MapKey) GetStrval() string {
538  return p.Strval
539}
540type MapKeyBuilder struct {
541  obj *MapKey
542}
543
544func NewMapKeyBuilder() *MapKeyBuilder{
545  return &MapKeyBuilder{
546    obj: NewMapKey(),
547  }
548}
549
550func (p MapKeyBuilder) Emit() *MapKey{
551  return &MapKey{
552    Num: p.obj.Num,
553    Strval: p.obj.Strval,
554  }
555}
556
557func (m *MapKeyBuilder) Num(num int64) *MapKeyBuilder {
558  m.obj.Num = num
559  return m
560}
561
562func (m *MapKeyBuilder) Strval(strval string) *MapKeyBuilder {
563  m.obj.Strval = strval
564  return m
565}
566
567func (m *MapKey) SetNum(num int64) *MapKey {
568  m.Num = num
569  return m
570}
571
572func (m *MapKey) SetStrval(strval string) *MapKey {
573  m.Strval = strval
574  return m
575}
576
577func (p *MapKey) Read(iprot thrift.Protocol) error {
578  if _, err := iprot.ReadStructBegin(); err != nil {
579    return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
580  }
581
582
583  for {
584    _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
585    if err != nil {
586      return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
587    }
588    if fieldTypeId == thrift.STOP { break; }
589    switch fieldId {
590    case 1:
591      if err := p.ReadField1(iprot); err != nil {
592        return err
593      }
594    case 2:
595      if err := p.ReadField2(iprot); err != nil {
596        return err
597      }
598    default:
599      if err := iprot.Skip(fieldTypeId); err != nil {
600        return err
601      }
602    }
603    if err := iprot.ReadFieldEnd(); err != nil {
604      return err
605    }
606  }
607  if err := iprot.ReadStructEnd(); err != nil {
608    return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
609  }
610  return nil
611}
612
613func (p *MapKey)  ReadField1(iprot thrift.Protocol) error {
614  if v, err := iprot.ReadI64(); err != nil {
615    return thrift.PrependError("error reading field 1: ", err)
616  } else {
617    p.Num = v
618  }
619  return nil
620}
621
622func (p *MapKey)  ReadField2(iprot thrift.Protocol) error {
623  if v, err := iprot.ReadString(); err != nil {
624    return thrift.PrependError("error reading field 2: ", err)
625  } else {
626    p.Strval = v
627  }
628  return nil
629}
630
631func (p *MapKey) Write(oprot thrift.Protocol) error {
632  if err := oprot.WriteStructBegin("MapKey"); err != nil {
633    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
634  if err := p.writeField1(oprot); err != nil { return err }
635  if err := p.writeField2(oprot); err != nil { return err }
636  if err := oprot.WriteFieldStop(); err != nil {
637    return thrift.PrependError("write field stop error: ", err) }
638  if err := oprot.WriteStructEnd(); err != nil {
639    return thrift.PrependError("write struct stop error: ", err) }
640  return nil
641}
642
643func (p *MapKey) writeField1(oprot thrift.Protocol) (err error) {
644  if err := oprot.WriteFieldBegin("num", thrift.I64, 1); err != nil {
645    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num: ", p), err) }
646  if err := oprot.WriteI64(int64(p.Num)); err != nil {
647  return thrift.PrependError(fmt.Sprintf("%T.num (1) field write error: ", p), err) }
648  if err := oprot.WriteFieldEnd(); err != nil {
649    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num: ", p), err) }
650  return err
651}
652
653func (p *MapKey) writeField2(oprot thrift.Protocol) (err error) {
654  if err := oprot.WriteFieldBegin("strval", thrift.STRING, 2); err != nil {
655    return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:strval: ", p), err) }
656  if err := oprot.WriteString(string(p.Strval)); err != nil {
657  return thrift.PrependError(fmt.Sprintf("%T.strval (2) field write error: ", p), err) }
658  if err := oprot.WriteFieldEnd(); err != nil {
659    return thrift.PrependError(fmt.Sprintf("%T write field end error 2:strval: ", p), err) }
660  return err
661}
662
663func (p *MapKey) String() string {
664  if p == nil {
665    return "<nil>"
666  }
667
668  numVal := fmt.Sprintf("%v", p.Num)
669  strvalVal := fmt.Sprintf("%v", p.Strval)
670  return fmt.Sprintf("MapKey({Num:%s Strval:%s})", numVal, strvalVal)
671}
672
673// Attributes:
674//  - Mapval
675type MapContainer struct {
676  Mapval map[MapKey]string `thrift:"mapval,1" db:"mapval" json:"mapval"`
677}
678
679func NewMapContainer() *MapContainer {
680  return &MapContainer{}
681}
682
683
684func (p *MapContainer) GetMapval() map[MapKey]string {
685  return p.Mapval
686}
687type MapContainerBuilder struct {
688  obj *MapContainer
689}
690
691func NewMapContainerBuilder() *MapContainerBuilder{
692  return &MapContainerBuilder{
693    obj: NewMapContainer(),
694  }
695}
696
697func (p MapContainerBuilder) Emit() *MapContainer{
698  return &MapContainer{
699    Mapval: p.obj.Mapval,
700  }
701}
702
703func (m *MapContainerBuilder) Mapval(mapval map[MapKey]string) *MapContainerBuilder {
704  m.obj.Mapval = mapval
705  return m
706}
707
708func (m *MapContainer) SetMapval(mapval map[MapKey]string) *MapContainer {
709  m.Mapval = mapval
710  return m
711}
712
713func (p *MapContainer) Read(iprot thrift.Protocol) error {
714  if _, err := iprot.ReadStructBegin(); err != nil {
715    return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
716  }
717
718
719  for {
720    _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
721    if err != nil {
722      return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
723    }
724    if fieldTypeId == thrift.STOP { break; }
725    switch fieldId {
726    case 1:
727      if err := p.ReadField1(iprot); err != nil {
728        return err
729      }
730    default:
731      if err := iprot.Skip(fieldTypeId); err != nil {
732        return err
733      }
734    }
735    if err := iprot.ReadFieldEnd(); err != nil {
736      return err
737    }
738  }
739  if err := iprot.ReadStructEnd(); err != nil {
740    return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
741  }
742  return nil
743}
744
745func (p *MapContainer)  ReadField1(iprot thrift.Protocol) error {
746  _, _, size, err := iprot.ReadMapBegin()
747  if err != nil {
748    return thrift.PrependError("error reading map begin: ", err)
749  }
750  tMap := make(map[MapKey]string, size)
751  p.Mapval =  tMap
752  for i := 0; i < size; i ++ {
753    _key5 := NewMapKey()
754    if err := _key5.Read(iprot); err != nil {
755      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key5), err)
756    }
757    var _val6 string
758    if v, err := iprot.ReadString(); err != nil {
759      return thrift.PrependError("error reading field 0: ", err)
760    } else {
761      _val6 = v
762    }
763    p.Mapval[*_key5] = _val6
764  }
765  if err := iprot.ReadMapEnd(); err != nil {
766    return thrift.PrependError("error reading map end: ", err)
767  }
768  return nil
769}
770
771func (p *MapContainer) Write(oprot thrift.Protocol) error {
772  if err := oprot.WriteStructBegin("MapContainer"); err != nil {
773    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
774  if err := p.writeField1(oprot); err != nil { return err }
775  if err := oprot.WriteFieldStop(); err != nil {
776    return thrift.PrependError("write field stop error: ", err) }
777  if err := oprot.WriteStructEnd(); err != nil {
778    return thrift.PrependError("write struct stop error: ", err) }
779  return nil
780}
781
782func (p *MapContainer) writeField1(oprot thrift.Protocol) (err error) {
783  if err := oprot.WriteFieldBegin("mapval", thrift.MAP, 1); err != nil {
784    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:mapval: ", p), err) }
785  if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRING, len(p.Mapval)); err != nil {
786    return thrift.PrependError("error writing map begin: ", err)
787  }
788  for k, v := range p.Mapval {
789    if err := k.Write(oprot); err != nil {
790      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
791    }
792    if err := oprot.WriteString(string(v)); err != nil {
793    return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) }
794  }
795  if err := oprot.WriteMapEnd(); err != nil {
796    return thrift.PrependError("error writing map end: ", err)
797  }
798  if err := oprot.WriteFieldEnd(); err != nil {
799    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:mapval: ", p), err) }
800  return err
801}
802
803func (p *MapContainer) String() string {
804  if p == nil {
805    return "<nil>"
806  }
807
808  mapvalVal := fmt.Sprintf("%v", p.Mapval)
809  return fmt.Sprintf("MapContainer({Mapval:%s})", mapvalVal)
810}
811
812// Attributes:
813//  - Automobile
814//  - Car
815type Pair struct {
816  Automobile *Automobile `thrift:"automobile,1" db:"automobile" json:"automobile"`
817  Car *Car `thrift:"car,2" db:"car" json:"car"`
818}
819
820func NewPair() *Pair {
821  return &Pair{
822    Automobile: NewAutomobile(),
823    Car: NewCar(),
824  }
825}
826
827var Pair_Automobile_DEFAULT *Automobile
828func (p *Pair) GetAutomobile() *Automobile {
829  if !p.IsSetAutomobile() {
830    return Pair_Automobile_DEFAULT
831  }
832return p.Automobile
833}
834var Pair_Car_DEFAULT *Car
835func (p *Pair) GetCar() *Car {
836  if !p.IsSetCar() {
837    return Pair_Car_DEFAULT
838  }
839return p.Car
840}
841func (p *Pair) IsSetAutomobile() bool {
842  return p != nil && p.Automobile != nil
843}
844
845func (p *Pair) IsSetCar() bool {
846  return p != nil && p.Car != nil
847}
848
849type PairBuilder struct {
850  obj *Pair
851}
852
853func NewPairBuilder() *PairBuilder{
854  return &PairBuilder{
855    obj: NewPair(),
856  }
857}
858
859func (p PairBuilder) Emit() *Pair{
860  return &Pair{
861    Automobile: p.obj.Automobile,
862    Car: p.obj.Car,
863  }
864}
865
866func (p *PairBuilder) Automobile(automobile *Automobile) *PairBuilder {
867  p.obj.Automobile = automobile
868  return p
869}
870
871func (p *PairBuilder) Car(car *Car) *PairBuilder {
872  p.obj.Car = car
873  return p
874}
875
876func (p *Pair) SetAutomobile(automobile *Automobile) *Pair {
877  p.Automobile = automobile
878  return p
879}
880
881func (p *Pair) SetCar(car *Car) *Pair {
882  p.Car = car
883  return p
884}
885
886func (p *Pair) Read(iprot thrift.Protocol) error {
887  if _, err := iprot.ReadStructBegin(); err != nil {
888    return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
889  }
890
891
892  for {
893    _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
894    if err != nil {
895      return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
896    }
897    if fieldTypeId == thrift.STOP { break; }
898    switch fieldId {
899    case 1:
900      if err := p.ReadField1(iprot); err != nil {
901        return err
902      }
903    case 2:
904      if err := p.ReadField2(iprot); err != nil {
905        return err
906      }
907    default:
908      if err := iprot.Skip(fieldTypeId); err != nil {
909        return err
910      }
911    }
912    if err := iprot.ReadFieldEnd(); err != nil {
913      return err
914    }
915  }
916  if err := iprot.ReadStructEnd(); err != nil {
917    return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
918  }
919  return nil
920}
921
922func (p *Pair)  ReadField1(iprot thrift.Protocol) error {
923  p.Automobile = NewAutomobile()
924  if err := p.Automobile.Read(iprot); err != nil {
925    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Automobile), err)
926  }
927  return nil
928}
929
930func (p *Pair)  ReadField2(iprot thrift.Protocol) error {
931  p.Car = NewCar()
932  if err := p.Car.Read(iprot); err != nil {
933    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Car), err)
934  }
935  return nil
936}
937
938func (p *Pair) Write(oprot thrift.Protocol) error {
939  if err := oprot.WriteStructBegin("Pair"); err != nil {
940    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
941  if err := p.writeField1(oprot); err != nil { return err }
942  if err := p.writeField2(oprot); err != nil { return err }
943  if err := oprot.WriteFieldStop(); err != nil {
944    return thrift.PrependError("write field stop error: ", err) }
945  if err := oprot.WriteStructEnd(); err != nil {
946    return thrift.PrependError("write struct stop error: ", err) }
947  return nil
948}
949
950func (p *Pair) writeField1(oprot thrift.Protocol) (err error) {
951  if err := oprot.WriteFieldBegin("automobile", thrift.STRUCT, 1); err != nil {
952    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:automobile: ", p), err) }
953  if err := p.Automobile.Write(oprot); err != nil {
954    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Automobile), err)
955  }
956  if err := oprot.WriteFieldEnd(); err != nil {
957    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:automobile: ", p), err) }
958  return err
959}
960
961func (p *Pair) writeField2(oprot thrift.Protocol) (err error) {
962  if err := oprot.WriteFieldBegin("car", thrift.STRUCT, 2); err != nil {
963    return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:car: ", p), err) }
964  if err := p.Car.Write(oprot); err != nil {
965    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Car), err)
966  }
967  if err := oprot.WriteFieldEnd(); err != nil {
968    return thrift.PrependError(fmt.Sprintf("%T write field end error 2:car: ", p), err) }
969  return err
970}
971
972func (p *Pair) String() string {
973  if p == nil {
974    return "<nil>"
975  }
976
977  var automobileVal string
978  if p.Automobile == nil {
979    automobileVal = "<nil>"
980  } else {
981    automobileVal = fmt.Sprintf("%v", p.Automobile)
982  }
983  var carVal string
984  if p.Car == nil {
985    carVal = "<nil>"
986  } else {
987    carVal = fmt.Sprintf("%v", p.Car)
988  }
989  return fmt.Sprintf("Pair({Automobile:%s Car:%s})", automobileVal, carVal)
990}
991
992// Attributes:
993//  - Automobiles
994//  - Cars
995type Collection struct {
996  Automobiles []*Automobile `thrift:"automobiles,1" db:"automobiles" json:"automobiles"`
997  Cars []*Car `thrift:"cars,2" db:"cars" json:"cars"`
998}
999
1000func NewCollection() *Collection {
1001  return &Collection{}
1002}
1003
1004
1005func (p *Collection) GetAutomobiles() []*Automobile {
1006  return p.Automobiles
1007}
1008
1009func (p *Collection) GetCars() []*Car {
1010  return p.Cars
1011}
1012type CollectionBuilder struct {
1013  obj *Collection
1014}
1015
1016func NewCollectionBuilder() *CollectionBuilder{
1017  return &CollectionBuilder{
1018    obj: NewCollection(),
1019  }
1020}
1021
1022func (p CollectionBuilder) Emit() *Collection{
1023  return &Collection{
1024    Automobiles: p.obj.Automobiles,
1025    Cars: p.obj.Cars,
1026  }
1027}
1028
1029func (c *CollectionBuilder) Automobiles(automobiles []*Automobile) *CollectionBuilder {
1030  c.obj.Automobiles = automobiles
1031  return c
1032}
1033
1034func (c *CollectionBuilder) Cars(cars []*Car) *CollectionBuilder {
1035  c.obj.Cars = cars
1036  return c
1037}
1038
1039func (c *Collection) SetAutomobiles(automobiles []*Automobile) *Collection {
1040  c.Automobiles = automobiles
1041  return c
1042}
1043
1044func (c *Collection) SetCars(cars []*Car) *Collection {
1045  c.Cars = cars
1046  return c
1047}
1048
1049func (p *Collection) Read(iprot thrift.Protocol) error {
1050  if _, err := iprot.ReadStructBegin(); err != nil {
1051    return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1052  }
1053
1054
1055  for {
1056    _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1057    if err != nil {
1058      return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1059    }
1060    if fieldTypeId == thrift.STOP { break; }
1061    switch fieldId {
1062    case 1:
1063      if err := p.ReadField1(iprot); err != nil {
1064        return err
1065      }
1066    case 2:
1067      if err := p.ReadField2(iprot); err != nil {
1068        return err
1069      }
1070    default:
1071      if err := iprot.Skip(fieldTypeId); err != nil {
1072        return err
1073      }
1074    }
1075    if err := iprot.ReadFieldEnd(); err != nil {
1076      return err
1077    }
1078  }
1079  if err := iprot.ReadStructEnd(); err != nil {
1080    return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1081  }
1082  return nil
1083}
1084
1085func (p *Collection)  ReadField1(iprot thrift.Protocol) error {
1086  _, size, err := iprot.ReadListBegin()
1087  if err != nil {
1088    return thrift.PrependError("error reading list begin: ", err)
1089  }
1090  tSlice := make([]*Automobile, 0, size)
1091  p.Automobiles =  tSlice
1092  for i := 0; i < size; i ++ {
1093    _elem7 := NewAutomobile()
1094    if err := _elem7.Read(iprot); err != nil {
1095      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem7), err)
1096    }
1097    p.Automobiles = append(p.Automobiles, _elem7)
1098  }
1099  if err := iprot.ReadListEnd(); err != nil {
1100    return thrift.PrependError("error reading list end: ", err)
1101  }
1102  return nil
1103}
1104
1105func (p *Collection)  ReadField2(iprot thrift.Protocol) error {
1106  _, size, err := iprot.ReadListBegin()
1107  if err != nil {
1108    return thrift.PrependError("error reading list begin: ", err)
1109  }
1110  tSlice := make([]*Car, 0, size)
1111  p.Cars =  tSlice
1112  for i := 0; i < size; i ++ {
1113    _elem8 := NewCar()
1114    if err := _elem8.Read(iprot); err != nil {
1115      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err)
1116    }
1117    p.Cars = append(p.Cars, _elem8)
1118  }
1119  if err := iprot.ReadListEnd(); err != nil {
1120    return thrift.PrependError("error reading list end: ", err)
1121  }
1122  return nil
1123}
1124
1125func (p *Collection) Write(oprot thrift.Protocol) error {
1126  if err := oprot.WriteStructBegin("Collection"); err != nil {
1127    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
1128  if err := p.writeField1(oprot); err != nil { return err }
1129  if err := p.writeField2(oprot); err != nil { return err }
1130  if err := oprot.WriteFieldStop(); err != nil {
1131    return thrift.PrependError("write field stop error: ", err) }
1132  if err := oprot.WriteStructEnd(); err != nil {
1133    return thrift.PrependError("write struct stop error: ", err) }
1134  return nil
1135}
1136
1137func (p *Collection) writeField1(oprot thrift.Protocol) (err error) {
1138  if err := oprot.WriteFieldBegin("automobiles", thrift.LIST, 1); err != nil {
1139    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:automobiles: ", p), err) }
1140  if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Automobiles)); err != nil {
1141    return thrift.PrependError("error writing list begin: ", err)
1142  }
1143  for _, v := range p.Automobiles {
1144    if err := v.Write(oprot); err != nil {
1145      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1146    }
1147  }
1148  if err := oprot.WriteListEnd(); err != nil {
1149    return thrift.PrependError("error writing list end: ", err)
1150  }
1151  if err := oprot.WriteFieldEnd(); err != nil {
1152    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:automobiles: ", p), err) }
1153  return err
1154}
1155
1156func (p *Collection) writeField2(oprot thrift.Protocol) (err error) {
1157  if err := oprot.WriteFieldBegin("cars", thrift.LIST, 2); err != nil {
1158    return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:cars: ", p), err) }
1159  if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Cars)); err != nil {
1160    return thrift.PrependError("error writing list begin: ", err)
1161  }
1162  for _, v := range p.Cars {
1163    if err := v.Write(oprot); err != nil {
1164      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1165    }
1166  }
1167  if err := oprot.WriteListEnd(); err != nil {
1168    return thrift.PrependError("error writing list end: ", err)
1169  }
1170  if err := oprot.WriteFieldEnd(); err != nil {
1171    return thrift.PrependError(fmt.Sprintf("%T write field end error 2:cars: ", p), err) }
1172  return err
1173}
1174
1175func (p *Collection) String() string {
1176  if p == nil {
1177    return "<nil>"
1178  }
1179
1180  automobilesVal := fmt.Sprintf("%v", p.Automobiles)
1181  carsVal := fmt.Sprintf("%v", p.Cars)
1182  return fmt.Sprintf("Collection({Automobiles:%s Cars:%s})", automobilesVal, carsVal)
1183}
1184
1185