當前位置: 首頁>>代碼示例>>Golang>>正文


Golang thrift.NewTProtocolExceptionReadStruct函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。