OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-kit / kit / examples / addsvc / thrift / gen-go / addsvc / addsvc.go
1 // Autogenerated by Thrift Compiler (1.0.0-dev)
2 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3
4 package addsvc
5
6 import (
7         "bytes"
8         "reflect"
9         "context"
10         "fmt"
11         "github.com/apache/thrift/lib/go/thrift"
12 )
13
14 // (needed to ensure safety because of naive import list construction.)
15 var _ = thrift.ZERO
16 var _ = fmt.Printf
17 var _ = context.Background
18 var _ = reflect.DeepEqual
19 var _ = bytes.Equal
20
21 // Attributes:
22 //  - Value
23 //  - Err
24 type SumReply struct {
25   Value int64 `thrift:"value,1" db:"value" json:"value"`
26   Err string `thrift:"err,2" db:"err" json:"err"`
27 }
28
29 func NewSumReply() *SumReply {
30   return &SumReply{}
31 }
32
33
34 func (p *SumReply) GetValue() int64 {
35   return p.Value
36 }
37
38 func (p *SumReply) GetErr() string {
39   return p.Err
40 }
41 func (p *SumReply) Read(iprot thrift.TProtocol) error {
42   if _, err := iprot.ReadStructBegin(); err != nil {
43     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
44   }
45
46
47   for {
48     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
49     if err != nil {
50       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
51     }
52     if fieldTypeId == thrift.STOP { break; }
53     switch fieldId {
54     case 1:
55       if fieldTypeId == thrift.I64 {
56         if err := p.ReadField1(iprot); err != nil {
57           return err
58         }
59       } else {
60         if err := iprot.Skip(fieldTypeId); err != nil {
61           return err
62         }
63       }
64     case 2:
65       if fieldTypeId == thrift.STRING {
66         if err := p.ReadField2(iprot); err != nil {
67           return err
68         }
69       } else {
70         if err := iprot.Skip(fieldTypeId); err != nil {
71           return err
72         }
73       }
74     default:
75       if err := iprot.Skip(fieldTypeId); err != nil {
76         return err
77       }
78     }
79     if err := iprot.ReadFieldEnd(); err != nil {
80       return err
81     }
82   }
83   if err := iprot.ReadStructEnd(); err != nil {
84     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
85   }
86   return nil
87 }
88
89 func (p *SumReply)  ReadField1(iprot thrift.TProtocol) error {
90   if v, err := iprot.ReadI64(); err != nil {
91   return thrift.PrependError("error reading field 1: ", err)
92 } else {
93   p.Value = v
94 }
95   return nil
96 }
97
98 func (p *SumReply)  ReadField2(iprot thrift.TProtocol) error {
99   if v, err := iprot.ReadString(); err != nil {
100   return thrift.PrependError("error reading field 2: ", err)
101 } else {
102   p.Err = v
103 }
104   return nil
105 }
106
107 func (p *SumReply) Write(oprot thrift.TProtocol) error {
108   if err := oprot.WriteStructBegin("SumReply"); err != nil {
109     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
110   if p != nil {
111     if err := p.writeField1(oprot); err != nil { return err }
112     if err := p.writeField2(oprot); err != nil { return err }
113   }
114   if err := oprot.WriteFieldStop(); err != nil {
115     return thrift.PrependError("write field stop error: ", err) }
116   if err := oprot.WriteStructEnd(); err != nil {
117     return thrift.PrependError("write struct stop error: ", err) }
118   return nil
119 }
120
121 func (p *SumReply) writeField1(oprot thrift.TProtocol) (err error) {
122   if err := oprot.WriteFieldBegin("value", thrift.I64, 1); err != nil {
123     return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) }
124   if err := oprot.WriteI64(int64(p.Value)); err != nil {
125   return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) }
126   if err := oprot.WriteFieldEnd(); err != nil {
127     return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) }
128   return err
129 }
130
131 func (p *SumReply) writeField2(oprot thrift.TProtocol) (err error) {
132   if err := oprot.WriteFieldBegin("err", thrift.STRING, 2); err != nil {
133     return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:err: ", p), err) }
134   if err := oprot.WriteString(string(p.Err)); err != nil {
135   return thrift.PrependError(fmt.Sprintf("%T.err (2) field write error: ", p), err) }
136   if err := oprot.WriteFieldEnd(); err != nil {
137     return thrift.PrependError(fmt.Sprintf("%T write field end error 2:err: ", p), err) }
138   return err
139 }
140
141 func (p *SumReply) String() string {
142   if p == nil {
143     return "<nil>"
144   }
145   return fmt.Sprintf("SumReply(%+v)", *p)
146 }
147
148 // Attributes:
149 //  - Value
150 //  - Err
151 type ConcatReply struct {
152   Value string `thrift:"value,1" db:"value" json:"value"`
153   Err string `thrift:"err,2" db:"err" json:"err"`
154 }
155
156 func NewConcatReply() *ConcatReply {
157   return &ConcatReply{}
158 }
159
160
161 func (p *ConcatReply) GetValue() string {
162   return p.Value
163 }
164
165 func (p *ConcatReply) GetErr() string {
166   return p.Err
167 }
168 func (p *ConcatReply) Read(iprot thrift.TProtocol) error {
169   if _, err := iprot.ReadStructBegin(); err != nil {
170     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
171   }
172
173
174   for {
175     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
176     if err != nil {
177       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
178     }
179     if fieldTypeId == thrift.STOP { break; }
180     switch fieldId {
181     case 1:
182       if fieldTypeId == thrift.STRING {
183         if err := p.ReadField1(iprot); err != nil {
184           return err
185         }
186       } else {
187         if err := iprot.Skip(fieldTypeId); err != nil {
188           return err
189         }
190       }
191     case 2:
192       if fieldTypeId == thrift.STRING {
193         if err := p.ReadField2(iprot); err != nil {
194           return err
195         }
196       } else {
197         if err := iprot.Skip(fieldTypeId); err != nil {
198           return err
199         }
200       }
201     default:
202       if err := iprot.Skip(fieldTypeId); err != nil {
203         return err
204       }
205     }
206     if err := iprot.ReadFieldEnd(); err != nil {
207       return err
208     }
209   }
210   if err := iprot.ReadStructEnd(); err != nil {
211     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
212   }
213   return nil
214 }
215
216 func (p *ConcatReply)  ReadField1(iprot thrift.TProtocol) error {
217   if v, err := iprot.ReadString(); err != nil {
218   return thrift.PrependError("error reading field 1: ", err)
219 } else {
220   p.Value = v
221 }
222   return nil
223 }
224
225 func (p *ConcatReply)  ReadField2(iprot thrift.TProtocol) error {
226   if v, err := iprot.ReadString(); err != nil {
227   return thrift.PrependError("error reading field 2: ", err)
228 } else {
229   p.Err = v
230 }
231   return nil
232 }
233
234 func (p *ConcatReply) Write(oprot thrift.TProtocol) error {
235   if err := oprot.WriteStructBegin("ConcatReply"); err != nil {
236     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
237   if p != nil {
238     if err := p.writeField1(oprot); err != nil { return err }
239     if err := p.writeField2(oprot); err != nil { return err }
240   }
241   if err := oprot.WriteFieldStop(); err != nil {
242     return thrift.PrependError("write field stop error: ", err) }
243   if err := oprot.WriteStructEnd(); err != nil {
244     return thrift.PrependError("write struct stop error: ", err) }
245   return nil
246 }
247
248 func (p *ConcatReply) writeField1(oprot thrift.TProtocol) (err error) {
249   if err := oprot.WriteFieldBegin("value", thrift.STRING, 1); err != nil {
250     return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) }
251   if err := oprot.WriteString(string(p.Value)); err != nil {
252   return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) }
253   if err := oprot.WriteFieldEnd(); err != nil {
254     return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) }
255   return err
256 }
257
258 func (p *ConcatReply) writeField2(oprot thrift.TProtocol) (err error) {
259   if err := oprot.WriteFieldBegin("err", thrift.STRING, 2); err != nil {
260     return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:err: ", p), err) }
261   if err := oprot.WriteString(string(p.Err)); err != nil {
262   return thrift.PrependError(fmt.Sprintf("%T.err (2) field write error: ", p), err) }
263   if err := oprot.WriteFieldEnd(); err != nil {
264     return thrift.PrependError(fmt.Sprintf("%T write field end error 2:err: ", p), err) }
265   return err
266 }
267
268 func (p *ConcatReply) String() string {
269   if p == nil {
270     return "<nil>"
271   }
272   return fmt.Sprintf("ConcatReply(%+v)", *p)
273 }
274
275 type AddService interface {
276   // Parameters:
277   //  - A
278   //  - B
279   Sum(ctx context.Context, a int64, b int64) (r *SumReply, err error)
280   // Parameters:
281   //  - A
282   //  - B
283   Concat(ctx context.Context, a string, b string) (r *ConcatReply, err error)
284 }
285
286 type AddServiceClient struct {
287   Transport thrift.TTransport
288   ProtocolFactory thrift.TProtocolFactory
289   InputProtocol thrift.TProtocol
290   OutputProtocol thrift.TProtocol
291   SeqId int32
292 }
293
294 func NewAddServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AddServiceClient {
295   return &AddServiceClient{Transport: t,
296     ProtocolFactory: f,
297     InputProtocol: f.GetProtocol(t),
298     OutputProtocol: f.GetProtocol(t),
299     SeqId: 0,
300   }
301 }
302
303 func NewAddServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AddServiceClient {
304   return &AddServiceClient{Transport: t,
305     ProtocolFactory: nil,
306     InputProtocol: iprot,
307     OutputProtocol: oprot,
308     SeqId: 0,
309   }
310 }
311
312 // Parameters:
313 //  - A
314 //  - B
315 func (p *AddServiceClient) Sum(ctx context.Context, a int64, b int64) (r *SumReply, err error) {
316   if err = p.sendSum(a, b); err != nil { return }
317   return p.recvSum()
318 }
319
320 func (p *AddServiceClient) sendSum(a int64, b int64)(err error) {
321   oprot := p.OutputProtocol
322   if oprot == nil {
323     oprot = p.ProtocolFactory.GetProtocol(p.Transport)
324     p.OutputProtocol = oprot
325   }
326   p.SeqId++
327   if err = oprot.WriteMessageBegin("Sum", thrift.CALL, p.SeqId); err != nil {
328       return
329   }
330   args := AddServiceSumArgs{
331   A : a,
332   B : b,
333   }
334   if err = args.Write(oprot); err != nil {
335       return
336   }
337   if err = oprot.WriteMessageEnd(); err != nil {
338       return
339   }
340   return oprot.Flush()
341 }
342
343
344 func (p *AddServiceClient) recvSum() (value *SumReply, err error) {
345   iprot := p.InputProtocol
346   if iprot == nil {
347     iprot = p.ProtocolFactory.GetProtocol(p.Transport)
348     p.InputProtocol = iprot
349   }
350   method, mTypeId, seqId, err := iprot.ReadMessageBegin()
351   if err != nil {
352     return
353   }
354   if method != "Sum" {
355     err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "Sum failed: wrong method name")
356     return
357   }
358   if p.SeqId != seqId {
359     err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Sum failed: out of sequence response")
360     return
361   }
362   if mTypeId == thrift.EXCEPTION {
363     error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
364     var error1 error
365     error1, err = error0.Read(iprot)
366     if err != nil {
367       return
368     }
369     if err = iprot.ReadMessageEnd(); err != nil {
370       return
371     }
372     err = error1
373     return
374   }
375   if mTypeId != thrift.REPLY {
376     err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "Sum failed: invalid message type")
377     return
378   }
379   result := AddServiceSumResult{}
380   if err = result.Read(iprot); err != nil {
381     return
382   }
383   if err = iprot.ReadMessageEnd(); err != nil {
384     return
385   }
386   value = result.GetSuccess()
387   return
388 }
389
390 // Parameters:
391 //  - A
392 //  - B
393 func (p *AddServiceClient) Concat(ctx context.Context, a string, b string) (r *ConcatReply, err error) {
394   if err = p.sendConcat(a, b); err != nil { return }
395   return p.recvConcat()
396 }
397
398 func (p *AddServiceClient) sendConcat(a string, b string)(err error) {
399   oprot := p.OutputProtocol
400   if oprot == nil {
401     oprot = p.ProtocolFactory.GetProtocol(p.Transport)
402     p.OutputProtocol = oprot
403   }
404   p.SeqId++
405   if err = oprot.WriteMessageBegin("Concat", thrift.CALL, p.SeqId); err != nil {
406       return
407   }
408   args := AddServiceConcatArgs{
409   A : a,
410   B : b,
411   }
412   if err = args.Write(oprot); err != nil {
413       return
414   }
415   if err = oprot.WriteMessageEnd(); err != nil {
416       return
417   }
418   return oprot.Flush()
419 }
420
421
422 func (p *AddServiceClient) recvConcat() (value *ConcatReply, err error) {
423   iprot := p.InputProtocol
424   if iprot == nil {
425     iprot = p.ProtocolFactory.GetProtocol(p.Transport)
426     p.InputProtocol = iprot
427   }
428   method, mTypeId, seqId, err := iprot.ReadMessageBegin()
429   if err != nil {
430     return
431   }
432   if method != "Concat" {
433     err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "Concat failed: wrong method name")
434     return
435   }
436   if p.SeqId != seqId {
437     err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Concat failed: out of sequence response")
438     return
439   }
440   if mTypeId == thrift.EXCEPTION {
441     error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
442     var error3 error
443     error3, err = error2.Read(iprot)
444     if err != nil {
445       return
446     }
447     if err = iprot.ReadMessageEnd(); err != nil {
448       return
449     }
450     err = error3
451     return
452   }
453   if mTypeId != thrift.REPLY {
454     err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "Concat failed: invalid message type")
455     return
456   }
457   result := AddServiceConcatResult{}
458   if err = result.Read(iprot); err != nil {
459     return
460   }
461   if err = iprot.ReadMessageEnd(); err != nil {
462     return
463   }
464   value = result.GetSuccess()
465   return
466 }
467
468
469 type AddServiceProcessor struct {
470   processorMap map[string]thrift.TProcessorFunction
471   handler AddService
472 }
473
474 func (p *AddServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
475   p.processorMap[key] = processor
476 }
477
478 func (p *AddServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
479   processor, ok = p.processorMap[key]
480   return processor, ok
481 }
482
483 func (p *AddServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
484   return p.processorMap
485 }
486
487 func NewAddServiceProcessor(handler AddService) *AddServiceProcessor {
488
489   self4 := &AddServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
490   self4.processorMap["Sum"] = &addServiceProcessorSum{handler:handler}
491   self4.processorMap["Concat"] = &addServiceProcessorConcat{handler:handler}
492 return self4
493 }
494
495 func (p *AddServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
496   name, _, seqId, err := iprot.ReadMessageBegin()
497   if err != nil { return false, err }
498   if processor, ok := p.GetProcessorFunction(name); ok {
499     return processor.Process(ctx, seqId, iprot, oprot)
500   }
501   iprot.Skip(thrift.STRUCT)
502   iprot.ReadMessageEnd()
503   x5 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
504   oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
505   x5.Write(oprot)
506   oprot.WriteMessageEnd()
507   oprot.Flush()
508   return false, x5
509
510 }
511
512 type addServiceProcessorSum struct {
513   handler AddService
514 }
515
516 func (p *addServiceProcessorSum) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
517   args := AddServiceSumArgs{}
518   if err = args.Read(iprot); err != nil {
519     iprot.ReadMessageEnd()
520     x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
521     oprot.WriteMessageBegin("Sum", thrift.EXCEPTION, seqId)
522     x.Write(oprot)
523     oprot.WriteMessageEnd()
524     oprot.Flush()
525     return false, err
526   }
527
528   iprot.ReadMessageEnd()
529   result := AddServiceSumResult{}
530 var retval *SumReply
531   var err2 error
532   if retval, err2 = p.handler.Sum(ctx, args.A, args.B); err2 != nil {
533     x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Sum: " + err2.Error())
534     oprot.WriteMessageBegin("Sum", thrift.EXCEPTION, seqId)
535     x.Write(oprot)
536     oprot.WriteMessageEnd()
537     oprot.Flush()
538     return true, err2
539   } else {
540     result.Success = retval
541 }
542   if err2 = oprot.WriteMessageBegin("Sum", thrift.REPLY, seqId); err2 != nil {
543     err = err2
544   }
545   if err2 = result.Write(oprot); err == nil && err2 != nil {
546     err = err2
547   }
548   if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
549     err = err2
550   }
551   if err2 = oprot.Flush(); err == nil && err2 != nil {
552     err = err2
553   }
554   if err != nil {
555     return
556   }
557   return true, err
558 }
559
560 type addServiceProcessorConcat struct {
561   handler AddService
562 }
563
564 func (p *addServiceProcessorConcat) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
565   args := AddServiceConcatArgs{}
566   if err = args.Read(iprot); err != nil {
567     iprot.ReadMessageEnd()
568     x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
569     oprot.WriteMessageBegin("Concat", thrift.EXCEPTION, seqId)
570     x.Write(oprot)
571     oprot.WriteMessageEnd()
572     oprot.Flush()
573     return false, err
574   }
575
576   iprot.ReadMessageEnd()
577   result := AddServiceConcatResult{}
578 var retval *ConcatReply
579   var err2 error
580   if retval, err2 = p.handler.Concat(ctx, args.A, args.B); err2 != nil {
581     x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Concat: " + err2.Error())
582     oprot.WriteMessageBegin("Concat", thrift.EXCEPTION, seqId)
583     x.Write(oprot)
584     oprot.WriteMessageEnd()
585     oprot.Flush()
586     return true, err2
587   } else {
588     result.Success = retval
589 }
590   if err2 = oprot.WriteMessageBegin("Concat", thrift.REPLY, seqId); err2 != nil {
591     err = err2
592   }
593   if err2 = result.Write(oprot); err == nil && err2 != nil {
594     err = err2
595   }
596   if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
597     err = err2
598   }
599   if err2 = oprot.Flush(); err == nil && err2 != nil {
600     err = err2
601   }
602   if err != nil {
603     return
604   }
605   return true, err
606 }
607
608
609 // HELPER FUNCTIONS AND STRUCTURES
610
611 // Attributes:
612 //  - A
613 //  - B
614 type AddServiceSumArgs struct {
615   A int64 `thrift:"a,1" db:"a" json:"a"`
616   B int64 `thrift:"b,2" db:"b" json:"b"`
617 }
618
619 func NewAddServiceSumArgs() *AddServiceSumArgs {
620   return &AddServiceSumArgs{}
621 }
622
623
624 func (p *AddServiceSumArgs) GetA() int64 {
625   return p.A
626 }
627
628 func (p *AddServiceSumArgs) GetB() int64 {
629   return p.B
630 }
631 func (p *AddServiceSumArgs) Read(iprot thrift.TProtocol) error {
632   if _, err := iprot.ReadStructBegin(); err != nil {
633     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
634   }
635
636
637   for {
638     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
639     if err != nil {
640       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
641     }
642     if fieldTypeId == thrift.STOP { break; }
643     switch fieldId {
644     case 1:
645       if fieldTypeId == thrift.I64 {
646         if err := p.ReadField1(iprot); err != nil {
647           return err
648         }
649       } else {
650         if err := iprot.Skip(fieldTypeId); err != nil {
651           return err
652         }
653       }
654     case 2:
655       if fieldTypeId == thrift.I64 {
656         if err := p.ReadField2(iprot); err != nil {
657           return err
658         }
659       } else {
660         if err := iprot.Skip(fieldTypeId); err != nil {
661           return err
662         }
663       }
664     default:
665       if err := iprot.Skip(fieldTypeId); err != nil {
666         return err
667       }
668     }
669     if err := iprot.ReadFieldEnd(); err != nil {
670       return err
671     }
672   }
673   if err := iprot.ReadStructEnd(); err != nil {
674     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
675   }
676   return nil
677 }
678
679 func (p *AddServiceSumArgs)  ReadField1(iprot thrift.TProtocol) error {
680   if v, err := iprot.ReadI64(); err != nil {
681   return thrift.PrependError("error reading field 1: ", err)
682 } else {
683   p.A = v
684 }
685   return nil
686 }
687
688 func (p *AddServiceSumArgs)  ReadField2(iprot thrift.TProtocol) error {
689   if v, err := iprot.ReadI64(); err != nil {
690   return thrift.PrependError("error reading field 2: ", err)
691 } else {
692   p.B = v
693 }
694   return nil
695 }
696
697 func (p *AddServiceSumArgs) Write(oprot thrift.TProtocol) error {
698   if err := oprot.WriteStructBegin("Sum_args"); err != nil {
699     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
700   if p != nil {
701     if err := p.writeField1(oprot); err != nil { return err }
702     if err := p.writeField2(oprot); err != nil { return err }
703   }
704   if err := oprot.WriteFieldStop(); err != nil {
705     return thrift.PrependError("write field stop error: ", err) }
706   if err := oprot.WriteStructEnd(); err != nil {
707     return thrift.PrependError("write struct stop error: ", err) }
708   return nil
709 }
710
711 func (p *AddServiceSumArgs) writeField1(oprot thrift.TProtocol) (err error) {
712   if err := oprot.WriteFieldBegin("a", thrift.I64, 1); err != nil {
713     return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:a: ", p), err) }
714   if err := oprot.WriteI64(int64(p.A)); err != nil {
715   return thrift.PrependError(fmt.Sprintf("%T.a (1) field write error: ", p), err) }
716   if err := oprot.WriteFieldEnd(); err != nil {
717     return thrift.PrependError(fmt.Sprintf("%T write field end error 1:a: ", p), err) }
718   return err
719 }
720
721 func (p *AddServiceSumArgs) writeField2(oprot thrift.TProtocol) (err error) {
722   if err := oprot.WriteFieldBegin("b", thrift.I64, 2); err != nil {
723     return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err) }
724   if err := oprot.WriteI64(int64(p.B)); err != nil {
725   return thrift.PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err) }
726   if err := oprot.WriteFieldEnd(); err != nil {
727     return thrift.PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err) }
728   return err
729 }
730
731 func (p *AddServiceSumArgs) String() string {
732   if p == nil {
733     return "<nil>"
734   }
735   return fmt.Sprintf("AddServiceSumArgs(%+v)", *p)
736 }
737
738 // Attributes:
739 //  - Success
740 type AddServiceSumResult struct {
741   Success *SumReply `thrift:"success,0" db:"success" json:"success,omitempty"`
742 }
743
744 func NewAddServiceSumResult() *AddServiceSumResult {
745   return &AddServiceSumResult{}
746 }
747
748 var AddServiceSumResult_Success_DEFAULT *SumReply
749 func (p *AddServiceSumResult) GetSuccess() *SumReply {
750   if !p.IsSetSuccess() {
751     return AddServiceSumResult_Success_DEFAULT
752   }
753 return p.Success
754 }
755 func (p *AddServiceSumResult) IsSetSuccess() bool {
756   return p.Success != nil
757 }
758
759 func (p *AddServiceSumResult) Read(iprot thrift.TProtocol) error {
760   if _, err := iprot.ReadStructBegin(); err != nil {
761     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
762   }
763
764
765   for {
766     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
767     if err != nil {
768       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
769     }
770     if fieldTypeId == thrift.STOP { break; }
771     switch fieldId {
772     case 0:
773       if fieldTypeId == thrift.STRUCT {
774         if err := p.ReadField0(iprot); err != nil {
775           return err
776         }
777       } else {
778         if err := iprot.Skip(fieldTypeId); err != nil {
779           return err
780         }
781       }
782     default:
783       if err := iprot.Skip(fieldTypeId); err != nil {
784         return err
785       }
786     }
787     if err := iprot.ReadFieldEnd(); err != nil {
788       return err
789     }
790   }
791   if err := iprot.ReadStructEnd(); err != nil {
792     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
793   }
794   return nil
795 }
796
797 func (p *AddServiceSumResult)  ReadField0(iprot thrift.TProtocol) error {
798   p.Success = &SumReply{}
799   if err := p.Success.Read(iprot); err != nil {
800     return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
801   }
802   return nil
803 }
804
805 func (p *AddServiceSumResult) Write(oprot thrift.TProtocol) error {
806   if err := oprot.WriteStructBegin("Sum_result"); err != nil {
807     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
808   if p != nil {
809     if err := p.writeField0(oprot); err != nil { return err }
810   }
811   if err := oprot.WriteFieldStop(); err != nil {
812     return thrift.PrependError("write field stop error: ", err) }
813   if err := oprot.WriteStructEnd(); err != nil {
814     return thrift.PrependError("write struct stop error: ", err) }
815   return nil
816 }
817
818 func (p *AddServiceSumResult) writeField0(oprot thrift.TProtocol) (err error) {
819   if p.IsSetSuccess() {
820     if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
821       return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
822     if err := p.Success.Write(oprot); err != nil {
823       return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
824     }
825     if err := oprot.WriteFieldEnd(); err != nil {
826       return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
827   }
828   return err
829 }
830
831 func (p *AddServiceSumResult) String() string {
832   if p == nil {
833     return "<nil>"
834   }
835   return fmt.Sprintf("AddServiceSumResult(%+v)", *p)
836 }
837
838 // Attributes:
839 //  - A
840 //  - B
841 type AddServiceConcatArgs struct {
842   A string `thrift:"a,1" db:"a" json:"a"`
843   B string `thrift:"b,2" db:"b" json:"b"`
844 }
845
846 func NewAddServiceConcatArgs() *AddServiceConcatArgs {
847   return &AddServiceConcatArgs{}
848 }
849
850
851 func (p *AddServiceConcatArgs) GetA() string {
852   return p.A
853 }
854
855 func (p *AddServiceConcatArgs) GetB() string {
856   return p.B
857 }
858 func (p *AddServiceConcatArgs) Read(iprot thrift.TProtocol) error {
859   if _, err := iprot.ReadStructBegin(); err != nil {
860     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
861   }
862
863
864   for {
865     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
866     if err != nil {
867       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
868     }
869     if fieldTypeId == thrift.STOP { break; }
870     switch fieldId {
871     case 1:
872       if fieldTypeId == thrift.STRING {
873         if err := p.ReadField1(iprot); err != nil {
874           return err
875         }
876       } else {
877         if err := iprot.Skip(fieldTypeId); err != nil {
878           return err
879         }
880       }
881     case 2:
882       if fieldTypeId == thrift.STRING {
883         if err := p.ReadField2(iprot); err != nil {
884           return err
885         }
886       } else {
887         if err := iprot.Skip(fieldTypeId); err != nil {
888           return err
889         }
890       }
891     default:
892       if err := iprot.Skip(fieldTypeId); err != nil {
893         return err
894       }
895     }
896     if err := iprot.ReadFieldEnd(); err != nil {
897       return err
898     }
899   }
900   if err := iprot.ReadStructEnd(); err != nil {
901     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
902   }
903   return nil
904 }
905
906 func (p *AddServiceConcatArgs)  ReadField1(iprot thrift.TProtocol) error {
907   if v, err := iprot.ReadString(); err != nil {
908   return thrift.PrependError("error reading field 1: ", err)
909 } else {
910   p.A = v
911 }
912   return nil
913 }
914
915 func (p *AddServiceConcatArgs)  ReadField2(iprot thrift.TProtocol) error {
916   if v, err := iprot.ReadString(); err != nil {
917   return thrift.PrependError("error reading field 2: ", err)
918 } else {
919   p.B = v
920 }
921   return nil
922 }
923
924 func (p *AddServiceConcatArgs) Write(oprot thrift.TProtocol) error {
925   if err := oprot.WriteStructBegin("Concat_args"); err != nil {
926     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
927   if p != nil {
928     if err := p.writeField1(oprot); err != nil { return err }
929     if err := p.writeField2(oprot); err != nil { return err }
930   }
931   if err := oprot.WriteFieldStop(); err != nil {
932     return thrift.PrependError("write field stop error: ", err) }
933   if err := oprot.WriteStructEnd(); err != nil {
934     return thrift.PrependError("write struct stop error: ", err) }
935   return nil
936 }
937
938 func (p *AddServiceConcatArgs) writeField1(oprot thrift.TProtocol) (err error) {
939   if err := oprot.WriteFieldBegin("a", thrift.STRING, 1); err != nil {
940     return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:a: ", p), err) }
941   if err := oprot.WriteString(string(p.A)); err != nil {
942   return thrift.PrependError(fmt.Sprintf("%T.a (1) field write error: ", p), err) }
943   if err := oprot.WriteFieldEnd(); err != nil {
944     return thrift.PrependError(fmt.Sprintf("%T write field end error 1:a: ", p), err) }
945   return err
946 }
947
948 func (p *AddServiceConcatArgs) writeField2(oprot thrift.TProtocol) (err error) {
949   if err := oprot.WriteFieldBegin("b", thrift.STRING, 2); err != nil {
950     return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err) }
951   if err := oprot.WriteString(string(p.B)); err != nil {
952   return thrift.PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err) }
953   if err := oprot.WriteFieldEnd(); err != nil {
954     return thrift.PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err) }
955   return err
956 }
957
958 func (p *AddServiceConcatArgs) String() string {
959   if p == nil {
960     return "<nil>"
961   }
962   return fmt.Sprintf("AddServiceConcatArgs(%+v)", *p)
963 }
964
965 // Attributes:
966 //  - Success
967 type AddServiceConcatResult struct {
968   Success *ConcatReply `thrift:"success,0" db:"success" json:"success,omitempty"`
969 }
970
971 func NewAddServiceConcatResult() *AddServiceConcatResult {
972   return &AddServiceConcatResult{}
973 }
974
975 var AddServiceConcatResult_Success_DEFAULT *ConcatReply
976 func (p *AddServiceConcatResult) GetSuccess() *ConcatReply {
977   if !p.IsSetSuccess() {
978     return AddServiceConcatResult_Success_DEFAULT
979   }
980 return p.Success
981 }
982 func (p *AddServiceConcatResult) IsSetSuccess() bool {
983   return p.Success != nil
984 }
985
986 func (p *AddServiceConcatResult) Read(iprot thrift.TProtocol) error {
987   if _, err := iprot.ReadStructBegin(); err != nil {
988     return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
989   }
990
991
992   for {
993     _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
994     if err != nil {
995       return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
996     }
997     if fieldTypeId == thrift.STOP { break; }
998     switch fieldId {
999     case 0:
1000       if fieldTypeId == thrift.STRUCT {
1001         if err := p.ReadField0(iprot); err != nil {
1002           return err
1003         }
1004       } else {
1005         if err := iprot.Skip(fieldTypeId); err != nil {
1006           return err
1007         }
1008       }
1009     default:
1010       if err := iprot.Skip(fieldTypeId); err != nil {
1011         return err
1012       }
1013     }
1014     if err := iprot.ReadFieldEnd(); err != nil {
1015       return err
1016     }
1017   }
1018   if err := iprot.ReadStructEnd(); err != nil {
1019     return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1020   }
1021   return nil
1022 }
1023
1024 func (p *AddServiceConcatResult)  ReadField0(iprot thrift.TProtocol) error {
1025   p.Success = &ConcatReply{}
1026   if err := p.Success.Read(iprot); err != nil {
1027     return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
1028   }
1029   return nil
1030 }
1031
1032 func (p *AddServiceConcatResult) Write(oprot thrift.TProtocol) error {
1033   if err := oprot.WriteStructBegin("Concat_result"); err != nil {
1034     return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
1035   if p != nil {
1036     if err := p.writeField0(oprot); err != nil { return err }
1037   }
1038   if err := oprot.WriteFieldStop(); err != nil {
1039     return thrift.PrependError("write field stop error: ", err) }
1040   if err := oprot.WriteStructEnd(); err != nil {
1041     return thrift.PrependError("write struct stop error: ", err) }
1042   return nil
1043 }
1044
1045 func (p *AddServiceConcatResult) writeField0(oprot thrift.TProtocol) (err error) {
1046   if p.IsSetSuccess() {
1047     if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
1048       return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
1049     if err := p.Success.Write(oprot); err != nil {
1050       return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
1051     }
1052     if err := oprot.WriteFieldEnd(); err != nil {
1053       return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
1054   }
1055   return err
1056 }
1057
1058 func (p *AddServiceConcatResult) String() string {
1059   if p == nil {
1060     return "<nil>"
1061   }
1062   return fmt.Sprintf("AddServiceConcatResult(%+v)", *p)
1063 }
1064
1065