本文整理匯總了Golang中github.com/apache/thrift/lib/go/thrift.TProtocol.Skip方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.Skip方法的具體用法?Golang TProtocol.Skip怎麽用?Golang TProtocol.Skip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/apache/thrift/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.Skip方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Read
func (p *AccountDoActionArgs) 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
}
示例2: Read
func (p *HealthCheckRes) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return fmt.Errorf("%T read error: %s", p, err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1:
if err := p.ReadField1(iprot); err != nil {
return err
}
case 2:
if err := p.ReadField2(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 fmt.Errorf("%T read struct end error: %s", p, err)
}
return nil
}
示例3: Read
func (p *FirstHealthcheckResult) 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
}
示例4: Read
func (p *NotAuthorized) 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
}
示例5: handle
// Mostly borrowed from generated thrift code `Process` method, but with timing added.
func (p ThriftOverHTTPHandler) handle(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 {
start := time.Now()
success, err = processor.Process(seqId, iprot, oprot)
if p.stats != nil {
p.stats.TimeSince(name, start)
}
return
}
iprot.Skip(thrift.STRUCT)
iprot.ReadMessageEnd()
e := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
e.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, e
}
示例6: Read
func (p *Span) 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
}
case 2:
if err := p.readField2(iprot); err != nil {
return err
}
case 3:
if err := p.readField3(iprot); err != nil {
return err
}
case 4:
if err := p.readField4(iprot); err != nil {
return err
}
case 5:
if err := p.readField5(iprot); err != nil {
return err
}
case 6:
if err := p.readField6(iprot); err != nil {
return err
}
case 7:
if err := p.readField7(iprot); err != nil {
return err
}
case 8:
if err := p.readField8(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
}
示例7: Read
func (p *VersionInfo) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
var issetLanguage bool = false
var issetLanguageVersion bool = false
var issetVersion bool = false
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
}
issetLanguage = true
case 2:
if err := p.readField2(iprot); err != nil {
return err
}
issetLanguageVersion = true
case 3:
if err := p.readField3(iprot); err != nil {
return err
}
issetVersion = true
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)
}
if !issetLanguage {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Language is not set"))
}
if !issetLanguageVersion {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field LanguageVersion is not set"))
}
if !issetVersion {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set"))
}
return nil
}
示例8: Read
func (p *BinaryAnnotation) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return fmt.Errorf("%T read error: %s", p, err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1:
if err := p.ReadField1(iprot); err != nil {
return err
}
case 2:
if err := p.ReadField2(iprot); err != nil {
return err
}
case 3:
if err := p.ReadField3(iprot); err != nil {
return err
}
case 4:
if err := p.ReadField4(iprot); err != nil {
return err
}
case 5:
if err := p.ReadField5(iprot); err != nil {
return err
}
case 6:
if err := p.ReadField6(iprot); err != nil {
return err
}
case 7:
if err := p.ReadField7(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 fmt.Errorf("%T read struct end error: %s", p, err)
}
return nil
}
示例9: Process
// Mostly borrowed from generated thrift code `Process` method, but with timing added.
func (p LoggedProcessor) 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 {
if p.debug {
log.Println("[rpc]", name)
}
start := time.Now()
success, err = processor.Process(seqId, iprot, oprot)
if p.stats != nil {
if err != nil {
if p.debug {
log.Println("[rpc]", name, err)
}
p.stats.Inc("rpc.error." + name)
}
dur := time.Now().Sub(start)
p.stats.Time("rpc.timing._all_", dur)
p.stats.Time("rpc.timing."+name, dur)
}
return success, err
}
iprot.Skip(thrift.STRUCT)
iprot.ReadMessageEnd()
e := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
if p.debug {
log.Println("[rpc] unknown function:", name)
}
if p.stats != nil {
p.stats.Inc("rpc.error.unknown_function." + name)
}
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
e.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, e
}
示例10: Process
func (p *AccountProcessor) 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()
x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
x3.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, x3
}
示例11: Read
func (p *HyperbahnDiscoverArgs) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
var issetQuery bool = false
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
}
issetQuery = true
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)
}
if !issetQuery {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Query is not set"))
}
return nil
}
示例12: Read
func (p *SimpleArgs) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return fmt.Errorf("%T read error: %s", p, err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return fmt.Errorf("%T field %d read error: %s", 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 fmt.Errorf("%T read struct end error: %s", p, err)
}
return nil
}