本文整理汇总了Golang中github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol.Skip方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.Skip方法的具体用法?Golang TProtocol.Skip怎么用?Golang TProtocol.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.Skip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Read
func (p *MyMethodResult) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
}
for {
fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if fieldId < 0 {
fieldId = int16(tstructMyMethodResult.FieldIdFromFieldName(fieldName))
fieldTypeId = tstructMyMethodResult.FieldFromFieldName(fieldName).TypeId()
}
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
default:
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} //switch
err = iprot.ReadFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
err = iprot.ReadStructEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
}
return err
}
示例2: Read
func (p *Ping) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
}
for {
fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if fieldId < 0 {
fieldId = int16(tstructPing.FieldIdFromFieldName(fieldName))
fieldTypeId = tstructPing.FieldFromFieldName(fieldName).TypeId()
}
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1: //i32
if fieldTypeId == thrift.I32 {
err = p.readField1(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
default:
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} //switch
err = iprot.ReadFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
err = iprot.ReadStructEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
}
return err
}
示例3: Process
func (p *ReverseOrderServiceProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
name, _, seqId, err := iprot.ReadMessageBegin()
if err != nil {
return
}
process, nameFound := p.GetProcessorFunction(name)
if !nameFound || process == nil {
iprot.Skip(thrift.STRUCT)
iprot.ReadMessageEnd()
x1118 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
x1118.Write(oprot)
oprot.WriteMessageEnd()
oprot.Transport().Flush()
return false, x1118
}
return process.Process(seqId, iprot, oprot)
}
示例4: Read
func (p *Manymaps) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
}
for {
fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if fieldId < 0 {
fieldId = int16(tstructManymaps.FieldIdFromFieldName(fieldName))
fieldTypeId = tstructManymaps.FieldFromFieldName(fieldName).TypeId()
}
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1: //
if fieldTypeId == thrift.MAP {
err = p.readField1(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
case 2: //
if fieldTypeId == thrift.MAP {
err = p.readField2(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
case 3: //
if fieldTypeId == thrift.MAP {
err = p.readField3(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
case 4: //
if fieldTypeId == thrift.MAP {
err = p.readField4(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
case 5: //
if fieldTypeId == thrift.MAP {
err = p.readField5(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
case 6: //
if fieldTypeId == thrift.MAP {
err = p.readField6(iprot)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} else {
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
}
default:
err = iprot.Skip(fieldTypeId)
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
} //switch
err = iprot.ReadFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
}
//.........这里部分代码省略.........