Last active
January 15, 2021 06:42
-
-
Save PureWhiteWu/63ac02ee613695213fe9eac4e22493ba to your computer and use it in GitHub Desktop.
使用人工智能优化 Golang 编译器 —— 新生成代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code generated by x. DO NOT EDIT. | |
package x | |
import ( | |
"context" | |
"fmt" | |
"github.com/apache/thrift/lib/go/thrift" | |
) | |
type Example struct { | |
Data1 [][]int64 `thrift:"data1,1" json:"data1"` | |
Data2 map[int64][]int8 `thrift:"data2,2" json:"data2"` | |
Data3 []map[int64]int8 `thrift:"data3,3" json:"data3"` | |
} | |
func NewExample() *Example { | |
return &Example{} | |
} | |
func (p *Example) GetData1() [][]int64 { | |
return p.Data1 | |
} | |
func (p *Example) GetData2() map[int64][]int8 { | |
return p.Data2 | |
} | |
func (p *Example) GetData3() []map[int64]int8 { | |
return p.Data3 | |
} | |
func (p *Example) SetData1(val [][]int64) { | |
p.Data1 = val | |
} | |
func (p *Example) SetData2(val map[int64][]int8) { | |
p.Data2 = val | |
} | |
func (p *Example) SetData3(val []map[int64]int8) { | |
p.Data3 = val | |
} | |
func (p *Example) Read(iprot thrift.TProtocol) error { | |
if _, err := iprot.ReadStructBegin(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) | |
} | |
for { | |
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() | |
if err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) | |
} | |
if fieldTypeId == thrift.STOP { | |
break | |
} | |
switch fieldId { | |
case 1: | |
if fieldTypeId == thrift.LIST { | |
if err := p.ReadField1(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field 1 'data1' error: ", p), err) | |
} | |
} else { | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T field 1 skip type %d error: ", p, fieldTypeId), err) | |
} | |
} | |
case 2: | |
if fieldTypeId == thrift.MAP { | |
if err := p.ReadField2(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field 2 'data2' error: ", p), err) | |
} | |
} else { | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T field 2 skip type %d error: ", p, fieldTypeId), err) | |
} | |
} | |
case 3: | |
if fieldTypeId == thrift.LIST { | |
if err := p.ReadField3(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field 3 'data3' error: ", p), err) | |
} | |
} else { | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T field 3 skip type %d error: ", p, fieldTypeId), err) | |
} | |
} | |
default: | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fieldId, fieldTypeId), err) | |
} | |
} | |
if err := iprot.ReadFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) | |
} | |
} | |
if err := iprot.ReadStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *Example) ReadField1(iprot thrift.TProtocol) error { | |
_, size, err := iprot.ReadListBegin() | |
if err != nil { | |
return thrift.PrependError("error reading list begin: ", err) | |
} | |
p.Data1 = make([][]int64, 0, size) | |
for i := 0; i < size; i++ { | |
_, size, err := iprot.ReadListBegin() | |
if err != nil { | |
return thrift.PrependError("error reading list begin: ", err) | |
} | |
_elem := make([]int64, 0, size) | |
for i := 0; i < size; i++ { | |
var _elem1 int64 | |
if v, err := iprot.ReadI64(); err != nil { | |
return thrift.PrependError("error reading type I64: ", err) | |
} else { | |
_elem1 = v | |
} | |
_elem = append(_elem, _elem1) | |
} | |
if err := iprot.ReadListEnd(); err != nil { | |
return thrift.PrependError("error reading list end: ", err) | |
} | |
p.Data1 = append(p.Data1, _elem) | |
} | |
if err := iprot.ReadListEnd(); err != nil { | |
return thrift.PrependError("error reading list end: ", err) | |
} | |
return nil | |
} | |
func (p *Example) ReadField2(iprot thrift.TProtocol) error { | |
_, _, size, err := iprot.ReadMapBegin() | |
if err != nil { | |
return thrift.PrependError("error reading map begin: ", err) | |
} | |
p.Data2 = make(map[int64][]int8, size) | |
for i := 0; i < size; i++ { | |
var _key int64 | |
if v, err := iprot.ReadI64(); err != nil { | |
return thrift.PrependError("error reading type I64: ", err) | |
} else { | |
_key = v | |
} | |
_, size, err := iprot.ReadListBegin() | |
if err != nil { | |
return thrift.PrependError("error reading list begin: ", err) | |
} | |
_val := make([]int8, 0, size) | |
for i := 0; i < size; i++ { | |
var _elem int8 | |
if v, err := iprot.ReadByte(); err != nil { | |
return thrift.PrependError("error reading type Byte: ", err) | |
} else { | |
_elem = v | |
} | |
_val = append(_val, _elem) | |
} | |
if err := iprot.ReadListEnd(); err != nil { | |
return thrift.PrependError("error reading list end: ", err) | |
} | |
p.Data2[_key] = _val | |
} | |
if err := iprot.ReadMapEnd(); err != nil { | |
return thrift.PrependError("error reading map end: ", err) | |
} | |
return nil | |
} | |
func (p *Example) ReadField3(iprot thrift.TProtocol) error { | |
_, size, err := iprot.ReadListBegin() | |
if err != nil { | |
return thrift.PrependError("error reading list begin: ", err) | |
} | |
p.Data3 = make([]map[int64]int8, 0, size) | |
for i := 0; i < size; i++ { | |
_, _, size, err := iprot.ReadMapBegin() | |
if err != nil { | |
return thrift.PrependError("error reading map begin: ", err) | |
} | |
_elem := make(map[int64]int8, size) | |
for i := 0; i < size; i++ { | |
var _key int64 | |
if v, err := iprot.ReadI64(); err != nil { | |
return thrift.PrependError("error reading type I64: ", err) | |
} else { | |
_key = v | |
} | |
var _val int8 | |
if v, err := iprot.ReadByte(); err != nil { | |
return thrift.PrependError("error reading type Byte: ", err) | |
} else { | |
_val = v | |
} | |
_elem[_key] = _val | |
} | |
if err := iprot.ReadMapEnd(); err != nil { | |
return thrift.PrependError("error reading map end: ", err) | |
} | |
p.Data3 = append(p.Data3, _elem) | |
} | |
if err := iprot.ReadListEnd(); err != nil { | |
return thrift.PrependError("error reading list end: ", err) | |
} | |
return nil | |
} | |
func (p *Example) Write(oprot thrift.TProtocol) error { | |
if err := oprot.WriteStructBegin("Example"); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) | |
} | |
if p != nil { | |
if err := p.writeField1(oprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'data1' error: ", p), err) | |
} | |
if err := p.writeField2(oprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 2 'data2' error: ", p), err) | |
} | |
if err := p.writeField3(oprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 3 'data3' error: ", p), err) | |
} | |
} | |
if err := oprot.WriteFieldStop(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) | |
} | |
if err := oprot.WriteStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *Example) writeField1(oprot thrift.TProtocol) error { | |
if err := oprot.WriteFieldBegin("data1", thrift.LIST, 1); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'data1' begin error: ", p), err) | |
} | |
if err := oprot.WriteListBegin(thrift.LIST, len(p.Data1)); err != nil { | |
return thrift.PrependError("error writing list begin: ", err) | |
} | |
for _, v := range p.Data1 { | |
if err := oprot.WriteListBegin(thrift.I64, len(v)); err != nil { | |
return thrift.PrependError("error writing list begin: ", err) | |
} | |
for _, v := range v { | |
if err := oprot.WriteI64(v); err != nil { | |
return thrift.PrependError("error writing type I64: ", err) | |
} | |
} | |
if err := oprot.WriteListEnd(); err != nil { | |
return thrift.PrependError("error writing list end: ", err) | |
} | |
} | |
if err := oprot.WriteListEnd(); err != nil { | |
return thrift.PrependError("error writing list end: ", err) | |
} | |
if err := oprot.WriteFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'data1' end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *Example) writeField2(oprot thrift.TProtocol) error { | |
if err := oprot.WriteFieldBegin("data2", thrift.MAP, 2); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 2 'data2' begin error: ", p), err) | |
} | |
if err := oprot.WriteMapBegin(thrift.I64, thrift.LIST, len(p.Data2)); err != nil { | |
return thrift.PrependError("error writing map begin: ", err) | |
} | |
for k, v := range p.Data2 { | |
if err := oprot.WriteI64(k); err != nil { | |
return thrift.PrependError("error writing type I64: ", err) | |
} | |
if err := oprot.WriteListBegin(thrift.BYTE, len(v)); err != nil { | |
return thrift.PrependError("error writing list begin: ", err) | |
} | |
for _, v := range v { | |
if err := oprot.WriteByte(v); err != nil { | |
return thrift.PrependError("error writing type Byte: ", err) | |
} | |
} | |
if err := oprot.WriteListEnd(); err != nil { | |
return thrift.PrependError("error writing list end: ", err) | |
} | |
} | |
if err := oprot.WriteMapEnd(); err != nil { | |
return thrift.PrependError("error writing map end: ", err) | |
} | |
if err := oprot.WriteFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 2 'data2' end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *Example) writeField3(oprot thrift.TProtocol) error { | |
if err := oprot.WriteFieldBegin("data3", thrift.LIST, 3); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 3 'data3' begin error: ", p), err) | |
} | |
if err := oprot.WriteListBegin(thrift.MAP, len(p.Data3)); err != nil { | |
return thrift.PrependError("error writing list begin: ", err) | |
} | |
for _, v := range p.Data3 { | |
if err := oprot.WriteMapBegin(thrift.I64, thrift.BYTE, len(v)); err != nil { | |
return thrift.PrependError("error writing map begin: ", err) | |
} | |
for k, v := range v { | |
if err := oprot.WriteI64(k); err != nil { | |
return thrift.PrependError("error writing type I64: ", err) | |
} | |
if err := oprot.WriteByte(v); err != nil { | |
return thrift.PrependError("error writing type Byte: ", err) | |
} | |
} | |
if err := oprot.WriteMapEnd(); err != nil { | |
return thrift.PrependError("error writing map end: ", err) | |
} | |
} | |
if err := oprot.WriteListEnd(); err != nil { | |
return thrift.PrependError("error writing list end: ", err) | |
} | |
if err := oprot.WriteFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 3 'data3' end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *Example) String() string { | |
if p == nil { | |
return "<nil>" | |
} | |
return fmt.Sprintf("Example(%+v)", *p) | |
} | |
type Serialize interface { | |
Method(ctx context.Context, req *Example) (r *Example, err error) | |
} | |
type SerializeClient struct { | |
c thrift.TClient | |
} | |
func NewSerializeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *SerializeClient { | |
return &SerializeClient{ | |
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), | |
} | |
} | |
func NewSerializeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *SerializeClient { | |
return &SerializeClient{ | |
c: thrift.NewTStandardClient(iprot, oprot), | |
} | |
} | |
func NewSerializeClient(c thrift.TClient) *SerializeClient { | |
return &SerializeClient{ | |
c: c, | |
} | |
} | |
func (p *SerializeClient) Client_() thrift.TClient { | |
return p.c | |
} | |
func (p *SerializeClient) Method(ctx context.Context, req *Example) (r *Example, err error) { | |
var _args SerializeMethodArgs | |
_args.Req = req | |
var _result SerializeMethodResult | |
if err = p.Client_().Call(ctx, "Method", &_args, &_result); err != nil { | |
return | |
} | |
return _result.GetSuccess(), nil | |
} | |
type SerializeProcessor struct { | |
processorMap map[string]thrift.TProcessorFunction | |
handler Serialize | |
} | |
func (p *SerializeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { | |
p.processorMap[key] = processor | |
} | |
func (p *SerializeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { | |
processor, ok = p.processorMap[key] | |
return processor, ok | |
} | |
func (p *SerializeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { | |
return p.processorMap | |
} | |
func NewSerializeProcessor(handler Serialize) *SerializeProcessor { | |
self := &SerializeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} | |
self.AddToProcessorMap("Method", &serializeProcessorMethod{handler: handler}) | |
return self | |
} | |
func (p *SerializeProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { | |
name, _, seqId, err := iprot.ReadMessageBegin() | |
if err != nil { | |
return false, err | |
} | |
if processor, ok := p.GetProcessorFunction(name); ok { | |
return processor.Process(ctx, seqId, iprot, oprot) | |
} | |
iprot.Skip(thrift.STRUCT) | |
iprot.ReadMessageEnd() | |
x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) | |
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) | |
x.Write(oprot) | |
oprot.WriteMessageEnd() | |
oprot.Flush(ctx) | |
return false, x | |
} | |
type serializeProcessorMethod struct { | |
handler Serialize | |
} | |
func (p *serializeProcessorMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { | |
args := SerializeMethodArgs{} | |
if err = args.Read(iprot); err != nil { | |
iprot.ReadMessageEnd() | |
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) | |
oprot.WriteMessageBegin("Method", thrift.EXCEPTION, seqId) | |
x.Write(oprot) | |
oprot.WriteMessageEnd() | |
oprot.Flush(ctx) | |
return false, err | |
} | |
iprot.ReadMessageEnd() | |
var err2 error | |
result := SerializeMethodResult{} | |
var retval *Example | |
if retval, err2 = p.handler.Method(ctx, args.Req); err2 != nil { | |
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Method: "+err2.Error()) | |
oprot.WriteMessageBegin("Method", thrift.EXCEPTION, seqId) | |
x.Write(oprot) | |
oprot.WriteMessageEnd() | |
oprot.Flush(ctx) | |
return true, err2 | |
} else { | |
result.Success = retval | |
} | |
if err2 = oprot.WriteMessageBegin("Method", thrift.REPLY, seqId); err2 != nil { | |
err = err2 | |
} | |
if err2 = result.Write(oprot); err == nil && err2 != nil { | |
err = err2 | |
} | |
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { | |
err = err2 | |
} | |
if err2 = oprot.Flush(ctx); err == nil && err2 != nil { | |
err = err2 | |
} | |
if err != nil { | |
return | |
} | |
return true, err | |
} | |
type SerializeMethodArgs struct { | |
Req *Example `thrift:"req,1" json:"req"` | |
} | |
func NewSerializeMethodArgs() *SerializeMethodArgs { | |
return &SerializeMethodArgs{} | |
} | |
var SerializeMethodArgs_Req_DEFAULT *Example | |
func (p *SerializeMethodArgs) GetReq() *Example { | |
if !p.IsSetReq() { | |
return SerializeMethodArgs_Req_DEFAULT | |
} | |
return p.Req | |
} | |
func (p *SerializeMethodArgs) SetReq(val *Example) { | |
p.Req = val | |
} | |
func (p *SerializeMethodArgs) IsSetReq() bool { | |
return p.Req != nil | |
} | |
func (p *SerializeMethodArgs) Read(iprot thrift.TProtocol) error { | |
if _, err := iprot.ReadStructBegin(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) | |
} | |
for { | |
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() | |
if err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) | |
} | |
if fieldTypeId == thrift.STOP { | |
break | |
} | |
switch fieldId { | |
case 1: | |
if fieldTypeId == thrift.STRUCT { | |
if err := p.ReadField1(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field 1 'req' error: ", p), err) | |
} | |
} else { | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T field 1 skip type %d error: ", p, fieldTypeId), err) | |
} | |
} | |
default: | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fieldId, fieldTypeId), err) | |
} | |
} | |
if err := iprot.ReadFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) | |
} | |
} | |
if err := iprot.ReadStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodArgs) ReadField1(iprot thrift.TProtocol) error { | |
p.Req = NewExample() | |
if err := p.Req.Read(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("error reading struct %T: ", p.Req), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodArgs) Write(oprot thrift.TProtocol) error { | |
if err := oprot.WriteStructBegin("method_args"); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) | |
} | |
if p != nil { | |
if err := p.writeField1(oprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'req' error: ", p), err) | |
} | |
} | |
if err := oprot.WriteFieldStop(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) | |
} | |
if err := oprot.WriteStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodArgs) writeField1(oprot thrift.TProtocol) error { | |
if err := oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'req' begin error: ", p), err) | |
} | |
if err := p.Req.Write(oprot); err != nil { | |
return err | |
} | |
if err := oprot.WriteFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 1 'req' end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodArgs) String() string { | |
if p == nil { | |
return "<nil>" | |
} | |
return fmt.Sprintf("SerializeMethodArgs(%+v)", *p) | |
} | |
type SerializeMethodResult struct { | |
Success *Example `thrift:"success,0" json:"success,omitempty"` | |
} | |
func NewSerializeMethodResult() *SerializeMethodResult { | |
return &SerializeMethodResult{} | |
} | |
var SerializeMethodResult_Success_DEFAULT *Example | |
func (p *SerializeMethodResult) GetSuccess() *Example { | |
if !p.IsSetSuccess() { | |
return SerializeMethodResult_Success_DEFAULT | |
} | |
return p.Success | |
} | |
func (p *SerializeMethodResult) SetSuccess(x interface{}) { | |
p.Success = x.(*Example) | |
} | |
func (p *SerializeMethodResult) IsSetSuccess() bool { | |
return p.Success != nil | |
} | |
func (p *SerializeMethodResult) Read(iprot thrift.TProtocol) error { | |
if _, err := iprot.ReadStructBegin(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) | |
} | |
for { | |
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() | |
if err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) | |
} | |
if fieldTypeId == thrift.STOP { | |
break | |
} | |
switch fieldId { | |
case 0: | |
if fieldTypeId == thrift.STRUCT { | |
if err := p.ReadField0(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field 0 'success' error: ", p), err) | |
} | |
} else { | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T field 0 skip type %d error: ", p, fieldTypeId), err) | |
} | |
} | |
default: | |
if err := iprot.Skip(fieldTypeId); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fieldId, fieldTypeId), err) | |
} | |
} | |
if err := iprot.ReadFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) | |
} | |
} | |
if err := iprot.ReadStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodResult) ReadField0(iprot thrift.TProtocol) error { | |
p.Success = NewExample() | |
if err := p.Success.Read(iprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("error reading struct %T: ", p.Success), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodResult) Write(oprot thrift.TProtocol) error { | |
if err := oprot.WriteStructBegin("method_result"); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) | |
} | |
if p != nil { | |
if err := p.writeField0(oprot); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 0 'success' error: ", p), err) | |
} | |
} | |
if err := oprot.WriteFieldStop(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) | |
} | |
if err := oprot.WriteStructEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) | |
} | |
return nil | |
} | |
func (p *SerializeMethodResult) writeField0(oprot thrift.TProtocol) error { | |
if p.IsSetSuccess() { | |
if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 0 'success' begin error: ", p), err) | |
} | |
if err := p.Success.Write(oprot); err != nil { | |
return err | |
} | |
if err := oprot.WriteFieldEnd(); err != nil { | |
return thrift.PrependError(fmt.Sprintf("%T write field 0 'success' end error: ", p), err) | |
} | |
} | |
return nil | |
} | |
func (p *SerializeMethodResult) String() string { | |
if p == nil { | |
return "<nil>" | |
} | |
return fmt.Sprintf("SerializeMethodResult(%+v)", *p) | |
} | |
func (p *SerializeMethodArgs) GetFirstArgument() interface{} { | |
return p.Req | |
} | |
func (p *SerializeMethodResult) GetResult() interface{} { | |
return p.Success | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment