本文整理汇总了Golang中github.com/apesternikov/thrift4go/lib/go/src/thrift.NewTProtocolExceptionReadStruct函数的典型用法代码示例。如果您正苦于以下问题:Golang NewTProtocolExceptionReadStruct函数的具体用法?Golang NewTProtocolExceptionReadStruct怎么用?Golang NewTProtocolExceptionReadStruct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewTProtocolExceptionReadStruct函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:mohanarpit,项目名称:goh,代码行数:35,代码来源:ReverseOrderService.go
示例2: Read
func (p *InvalidOperation) 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(tstructInvalidOperation.FieldIdFromFieldName(fieldName))
fieldTypeId = tstructInvalidOperation.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)
}
}
case 2: //string
if fieldTypeId == thrift.STRING {
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)
}
}
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
}
开发者ID:mohanarpit,项目名称:goh,代码行数:59,代码来源:ttypes.go
示例3: readField6
func (p *Manymaps) readField6(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_ktype70, _vtype71, _size69, err := iprot.ReadMapBegin()
if err != nil {
return thrift.NewTProtocolExceptionReadField(-1, "p.Binarstructymap", "", err)
}
_, _ = _ktype70, _vtype71
p.Binarstructymap = make(map[string]*Intstruct, _size69)
for i := 0; i < _size69; i++ {
v76, err77 := iprot.ReadString()
if err77 != nil {
return thrift.NewTProtocolExceptionReadField(0, "_key74", "", err77)
}
_key74 := v76
_val75 := NewIntstruct()
err80 := _val75.Read(iprot)
if err80 != nil {
return thrift.NewTProtocolExceptionReadStruct("_val75intstruct", err80)
}
p.Binarstructymap[_key74] = _val75
}
err = iprot.ReadMapEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadField(-1, "", "map", err)
}
return err
}
开发者ID:mohanarpit,项目名称:goh,代码行数:26,代码来源:ttypes.go
示例4: readField1
func (p *CalculateResult) readField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
p.Ouch = NewInvalidOperation()
err57 := p.Ouch.Read(iprot)
if err57 != nil {
return thrift.NewTProtocolExceptionReadStruct("p.OuchInvalidOperation", err57)
}
return err
}
开发者ID:mohanarpit,项目名称:goh,代码行数:8,代码来源:Calculator.go
示例5: readField2
func (p *CalculateArgs) readField2(iprot thrift.TProtocol) (err thrift.TProtocolException) {
p.W = NewWork()
err52 := p.W.Read(iprot)
if err52 != nil {
return thrift.NewTProtocolExceptionReadStruct("p.WWork", err52)
}
return err
}
开发者ID:mohanarpit,项目名称:goh,代码行数:8,代码来源:Calculator.go
示例6: readField1
func (p *PingArgs) readField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
p.Ts = NewPing()
err18 := p.Ts.Read(iprot)
if err18 != nil {
return thrift.NewTProtocolExceptionReadStruct("p.TsPing", err18)
}
return err
}
开发者ID:Digaku,项目名称:ansvia-lessons,代码行数:8,代码来源:TrancamServer.go
示例7: readField1
func (p *MethodThatThrowsAnExceptionResult) readField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
p.Xwamap = NewExceptionWithAMap()
err1050 := p.Xwamap.Read(iprot)
if err1050 != nil {
return thrift.NewTProtocolExceptionReadStruct("p.XwamapExceptionWithAMap", err1050)
}
return err
}
开发者ID:mohanarpit,项目名称:goh,代码行数:8,代码来源:ServiceForExceptionWithAMap.go
示例8: readField5
func (p *Manylists) readField5(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_etype51, _size48, err := iprot.ReadListBegin()
if err != nil {
return thrift.NewTProtocolExceptionReadField(-1, "p.Structlist", "", err)
}
_ = _etype51
p.Structlist = make([]*Intstruct, _size48, _size48)
for i := 0; i < _size48; i++ {
_elem53 := NewIntstruct()
err56 := _elem53.Read(iprot)
if err56 != nil {
return thrift.NewTProtocolExceptionReadStruct("_elem53intstruct", err56)
}
p.Structlist[i] = _elem53
}
err = iprot.ReadListEnd()
if err != nil {
return thrift.NewTProtocolExceptionReadField(-1, "", "list", err)
}
return err
}
开发者ID:mohanarpit,项目名称:goh,代码行数:21,代码来源:ttypes.go
注:本文中的github.com/apesternikov/thrift4go/lib/go/src/thrift.NewTProtocolExceptionReadStruct函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论