thrift/gen-go/meta/meta.go (870 lines of code) (raw):

// Autogenerated by Thrift Compiler (1.0.0-dev) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package meta import ( "bytes" "fmt" "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" ) // (needed to ensure safety because of naive import list construction.) var _ = thrift.ZERO var _ = fmt.Printf var _ = bytes.Equal type Meta interface { // Parameters: // - Hr Health(hr *HealthRequest) (r *HealthStatus, err error) ThriftIDL() (r *ThriftIDLs, err error) VersionInfo() (r *VersionInfo, err error) } type MetaClient struct { Transport thrift.TTransport ProtocolFactory thrift.TProtocolFactory InputProtocol thrift.TProtocol OutputProtocol thrift.TProtocol SeqId int32 } func NewMetaClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *MetaClient { return &MetaClient{Transport: t, ProtocolFactory: f, InputProtocol: f.GetProtocol(t), OutputProtocol: f.GetProtocol(t), SeqId: 0, } } func NewMetaClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *MetaClient { return &MetaClient{Transport: t, ProtocolFactory: nil, InputProtocol: iprot, OutputProtocol: oprot, SeqId: 0, } } // Parameters: // - Hr func (p *MetaClient) Health(hr *HealthRequest) (r *HealthStatus, err error) { if err = p.sendHealth(hr); err != nil { return } return p.recvHealth() } func (p *MetaClient) sendHealth(hr *HealthRequest) (err error) { oprot := p.OutputProtocol if oprot == nil { oprot = p.ProtocolFactory.GetProtocol(p.Transport) p.OutputProtocol = oprot } p.SeqId++ if err = oprot.WriteMessageBegin("health", thrift.CALL, p.SeqId); err != nil { return } args := MetaHealthArgs{ Hr: hr, } if err = args.Write(oprot); err != nil { return } if err = oprot.WriteMessageEnd(); err != nil { return } return oprot.Flush() } func (p *MetaClient) recvHealth() (value *HealthStatus, err error) { iprot := p.InputProtocol if iprot == nil { iprot = p.ProtocolFactory.GetProtocol(p.Transport) p.InputProtocol = iprot } method, mTypeId, seqId, err := iprot.ReadMessageBegin() if err != nil { return } if method != "health" { err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "health failed: wrong method name") return } if p.SeqId != seqId { err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "health failed: out of sequence response") return } if mTypeId == thrift.EXCEPTION { error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") var error3 error error3, err = error2.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } err = error3 return } if mTypeId != thrift.REPLY { err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "health failed: invalid message type") return } result := MetaHealthResult{} if err = result.Read(iprot); err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } value = result.GetSuccess() return } func (p *MetaClient) ThriftIDL() (r *ThriftIDLs, err error) { if err = p.sendThriftIDL(); err != nil { return } return p.recvThriftIDL() } func (p *MetaClient) sendThriftIDL() (err error) { oprot := p.OutputProtocol if oprot == nil { oprot = p.ProtocolFactory.GetProtocol(p.Transport) p.OutputProtocol = oprot } p.SeqId++ if err = oprot.WriteMessageBegin("thriftIDL", thrift.CALL, p.SeqId); err != nil { return } args := MetaThriftIDLArgs{} if err = args.Write(oprot); err != nil { return } if err = oprot.WriteMessageEnd(); err != nil { return } return oprot.Flush() } func (p *MetaClient) recvThriftIDL() (value *ThriftIDLs, err error) { iprot := p.InputProtocol if iprot == nil { iprot = p.ProtocolFactory.GetProtocol(p.Transport) p.InputProtocol = iprot } method, mTypeId, seqId, err := iprot.ReadMessageBegin() if err != nil { return } if method != "thriftIDL" { err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "thriftIDL failed: wrong method name") return } if p.SeqId != seqId { err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "thriftIDL failed: out of sequence response") return } if mTypeId == thrift.EXCEPTION { error4 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") var error5 error error5, err = error4.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } err = error5 return } if mTypeId != thrift.REPLY { err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "thriftIDL failed: invalid message type") return } result := MetaThriftIDLResult{} if err = result.Read(iprot); err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } value = result.GetSuccess() return } func (p *MetaClient) VersionInfo() (r *VersionInfo, err error) { if err = p.sendVersionInfo(); err != nil { return } return p.recvVersionInfo() } func (p *MetaClient) sendVersionInfo() (err error) { oprot := p.OutputProtocol if oprot == nil { oprot = p.ProtocolFactory.GetProtocol(p.Transport) p.OutputProtocol = oprot } p.SeqId++ if err = oprot.WriteMessageBegin("versionInfo", thrift.CALL, p.SeqId); err != nil { return } args := MetaVersionInfoArgs{} if err = args.Write(oprot); err != nil { return } if err = oprot.WriteMessageEnd(); err != nil { return } return oprot.Flush() } func (p *MetaClient) recvVersionInfo() (value *VersionInfo, err error) { iprot := p.InputProtocol if iprot == nil { iprot = p.ProtocolFactory.GetProtocol(p.Transport) p.InputProtocol = iprot } method, mTypeId, seqId, err := iprot.ReadMessageBegin() if err != nil { return } if method != "versionInfo" { err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "versionInfo failed: wrong method name") return } if p.SeqId != seqId { err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "versionInfo failed: out of sequence response") return } if mTypeId == thrift.EXCEPTION { error6 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") var error7 error error7, err = error6.Read(iprot) if err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } err = error7 return } if mTypeId != thrift.REPLY { err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "versionInfo failed: invalid message type") return } result := MetaVersionInfoResult{} if err = result.Read(iprot); err != nil { return } if err = iprot.ReadMessageEnd(); err != nil { return } value = result.GetSuccess() return } type MetaProcessor struct { processorMap map[string]thrift.TProcessorFunction handler Meta } func (p *MetaProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { p.processorMap[key] = processor } func (p *MetaProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { processor, ok = p.processorMap[key] return processor, ok } func (p *MetaProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { return p.processorMap } func NewMetaProcessor(handler Meta) *MetaProcessor { self8 := &MetaProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} self8.processorMap["health"] = &metaProcessorHealth{handler: handler} self8.processorMap["thriftIDL"] = &metaProcessorThriftIDL{handler: handler} self8.processorMap["versionInfo"] = &metaProcessorVersionInfo{handler: handler} return self8 } func (p *MetaProcessor) Process(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(seqId, iprot, oprot) } iprot.Skip(thrift.STRUCT) iprot.ReadMessageEnd() x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) x9.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, x9 } type metaProcessorHealth struct { handler Meta } func (p *metaProcessorHealth) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := MetaHealthArgs{} if err = args.Read(iprot); err != nil { iprot.ReadMessageEnd() x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) oprot.WriteMessageBegin("health", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, err } iprot.ReadMessageEnd() result := MetaHealthResult{} var retval *HealthStatus var err2 error if retval, err2 = p.handler.Health(args.Hr); err2 != nil { x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing health: "+err2.Error()) oprot.WriteMessageBegin("health", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return true, err2 } else { result.Success = retval } if err2 = oprot.WriteMessageBegin("health", 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(); err == nil && err2 != nil { err = err2 } if err != nil { return } return true, err } type metaProcessorThriftIDL struct { handler Meta } func (p *metaProcessorThriftIDL) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := MetaThriftIDLArgs{} if err = args.Read(iprot); err != nil { iprot.ReadMessageEnd() x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) oprot.WriteMessageBegin("thriftIDL", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, err } iprot.ReadMessageEnd() result := MetaThriftIDLResult{} var retval *ThriftIDLs var err2 error if retval, err2 = p.handler.ThriftIDL(); err2 != nil { x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing thriftIDL: "+err2.Error()) oprot.WriteMessageBegin("thriftIDL", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return true, err2 } else { result.Success = retval } if err2 = oprot.WriteMessageBegin("thriftIDL", 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(); err == nil && err2 != nil { err = err2 } if err != nil { return } return true, err } type metaProcessorVersionInfo struct { handler Meta } func (p *metaProcessorVersionInfo) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := MetaVersionInfoArgs{} if err = args.Read(iprot); err != nil { iprot.ReadMessageEnd() x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) oprot.WriteMessageBegin("versionInfo", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, err } iprot.ReadMessageEnd() result := MetaVersionInfoResult{} var retval *VersionInfo var err2 error if retval, err2 = p.handler.VersionInfo(); err2 != nil { x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing versionInfo: "+err2.Error()) oprot.WriteMessageBegin("versionInfo", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return true, err2 } else { result.Success = retval } if err2 = oprot.WriteMessageBegin("versionInfo", 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(); err == nil && err2 != nil { err = err2 } if err != nil { return } return true, err } // HELPER FUNCTIONS AND STRUCTURES // Attributes: // - Hr type MetaHealthArgs struct { Hr *HealthRequest `thrift:"hr,1" db:"hr" json:"hr"` } func NewMetaHealthArgs() *MetaHealthArgs { return &MetaHealthArgs{} } var MetaHealthArgs_Hr_DEFAULT *HealthRequest func (p *MetaHealthArgs) GetHr() *HealthRequest { if !p.IsSetHr() { return MetaHealthArgs_Hr_DEFAULT } return p.Hr } func (p *MetaHealthArgs) IsSetHr() bool { return p.Hr != nil } func (p *MetaHealthArgs) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } switch fieldId { case 1: if err := p.ReadField1(iprot); err != nil { return err } default: if err := iprot.Skip(fieldTypeId); err != nil { return err } } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaHealthArgs) ReadField1(iprot thrift.TProtocol) error { p.Hr = &HealthRequest{} if err := p.Hr.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hr), err) } return nil } func (p *MetaHealthArgs) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("health_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := p.writeField1(oprot); err != nil { return err } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaHealthArgs) writeField1(oprot thrift.TProtocol) (err error) { if err := oprot.WriteFieldBegin("hr", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hr: ", p), err) } if err := p.Hr.Write(oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hr), err) } if err := oprot.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hr: ", p), err) } return err } func (p *MetaHealthArgs) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaHealthArgs(%+v)", *p) } // Attributes: // - Success type MetaHealthResult struct { Success *HealthStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewMetaHealthResult() *MetaHealthResult { return &MetaHealthResult{} } var MetaHealthResult_Success_DEFAULT *HealthStatus func (p *MetaHealthResult) GetSuccess() *HealthStatus { if !p.IsSetSuccess() { return MetaHealthResult_Success_DEFAULT } return p.Success } func (p *MetaHealthResult) IsSetSuccess() bool { return p.Success != nil } func (p *MetaHealthResult) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } switch fieldId { case 0: if err := p.ReadField0(iprot); err != nil { return err } default: if err := iprot.Skip(fieldTypeId); err != nil { return err } } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaHealthResult) ReadField0(iprot thrift.TProtocol) error { p.Success = &HealthStatus{} if err := p.Success.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } func (p *MetaHealthResult) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("health_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := p.writeField0(oprot); err != nil { return err } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaHealthResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } if err := p.Success.Write(oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } if err := oprot.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err } func (p *MetaHealthResult) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaHealthResult(%+v)", *p) } type MetaThriftIDLArgs struct { } func NewMetaThriftIDLArgs() *MetaThriftIDLArgs { return &MetaThriftIDLArgs{} } func (p *MetaThriftIDLArgs) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } if err := iprot.Skip(fieldTypeId); err != nil { return err } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaThriftIDLArgs) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("thriftIDL_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaThriftIDLArgs) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaThriftIDLArgs(%+v)", *p) } // Attributes: // - Success type MetaThriftIDLResult struct { Success *ThriftIDLs `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewMetaThriftIDLResult() *MetaThriftIDLResult { return &MetaThriftIDLResult{} } var MetaThriftIDLResult_Success_DEFAULT *ThriftIDLs func (p *MetaThriftIDLResult) GetSuccess() *ThriftIDLs { if !p.IsSetSuccess() { return MetaThriftIDLResult_Success_DEFAULT } return p.Success } func (p *MetaThriftIDLResult) IsSetSuccess() bool { return p.Success != nil } func (p *MetaThriftIDLResult) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } switch fieldId { case 0: if err := p.ReadField0(iprot); err != nil { return err } default: if err := iprot.Skip(fieldTypeId); err != nil { return err } } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaThriftIDLResult) ReadField0(iprot thrift.TProtocol) error { p.Success = &ThriftIDLs{} if err := p.Success.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } func (p *MetaThriftIDLResult) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("thriftIDL_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := p.writeField0(oprot); err != nil { return err } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaThriftIDLResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } if err := p.Success.Write(oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } if err := oprot.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err } func (p *MetaThriftIDLResult) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaThriftIDLResult(%+v)", *p) } type MetaVersionInfoArgs struct { } func NewMetaVersionInfoArgs() *MetaVersionInfoArgs { return &MetaVersionInfoArgs{} } func (p *MetaVersionInfoArgs) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } if err := iprot.Skip(fieldTypeId); err != nil { return err } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaVersionInfoArgs) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("versionInfo_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaVersionInfoArgs) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaVersionInfoArgs(%+v)", *p) } // Attributes: // - Success type MetaVersionInfoResult struct { Success *VersionInfo `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewMetaVersionInfoResult() *MetaVersionInfoResult { return &MetaVersionInfoResult{} } var MetaVersionInfoResult_Success_DEFAULT *VersionInfo func (p *MetaVersionInfoResult) GetSuccess() *VersionInfo { if !p.IsSetSuccess() { return MetaVersionInfoResult_Success_DEFAULT } return p.Success } func (p *MetaVersionInfoResult) IsSetSuccess() bool { return p.Success != nil } func (p *MetaVersionInfoResult) Read(iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break } switch fieldId { case 0: if err := p.ReadField0(iprot); err != nil { return err } default: if err := iprot.Skip(fieldTypeId); err != nil { return err } } if err := iprot.ReadFieldEnd(); err != nil { return err } } if err := iprot.ReadStructEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } func (p *MetaVersionInfoResult) ReadField0(iprot thrift.TProtocol) error { p.Success = &VersionInfo{} if err := p.Success.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } func (p *MetaVersionInfoResult) Write(oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin("versionInfo_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if err := p.writeField0(oprot); err != nil { return err } if err := oprot.WriteFieldStop(); err != nil { return thrift.PrependError("write field stop error: ", err) } if err := oprot.WriteStructEnd(); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } func (p *MetaVersionInfoResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } if err := p.Success.Write(oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } if err := oprot.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err } func (p *MetaVersionInfoResult) String() string { if p == nil { return "<nil>" } return fmt.Sprintf("MetaVersionInfoResult(%+v)", *p) }