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


Golang thrift.TProtocol類代碼示例

本文整理匯總了Golang中thrift.TProtocol的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol類的具體用法?Golang TProtocol怎麽用?Golang TProtocol使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TProtocol類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Read

func (p *FindAllResult) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return fmt.Errorf("%T read error", p)
	}
	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 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 fmt.Errorf("%T read struct end error: %s", p, err)
	}
	return nil
}
開發者ID:viney,項目名稱:gothrift,代碼行數:31,代碼來源:rpc_service.go

示例2: Read

func (p *SecondServiceSecondtestStringResult) 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
}
開發者ID:sktzwhj,項目名稱:thrift-0.9.3,代碼行數:32,代碼來源:secondservice.go

示例3: ReadField3

func (p *ContainerOfEnums) ReadField3(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v4, err5 := iprot.ReadI32()
	if err5 != nil {
		return thrift.NewTProtocolExceptionReadField(3, "third", p.ThriftName(), err5)
	}
	p.Third = HeterogeneousValues(v4)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例4: readField2

func (p *FindAllArgs) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 2: %s")
	} else {
		p.Password = v
	}
	return nil
}
開發者ID:viney,項目名稱:gothrift,代碼行數:8,代碼來源:rpc_service.go

示例5: readField1

func (p *FindAllArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return fmt.Errorf("error reading field 1: %s")
	} else {
		p.Userid = v
	}
	return nil
}
開發者ID:viney,項目名稱:gothrift,代碼行數:8,代碼來源:rpc_service.go

示例6: ReadField4

func (p *ContainerOfEnums) ReadField4(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v6, err7 := iprot.ReadI32()
	if err7 != nil {
		return thrift.NewTProtocolExceptionReadField(4, "optional_fourth", p.ThriftName(), err7)
	}
	p.OptionalFourth = UndefinedValues(v6)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例7: ReadField5

func (p *ContainerOfEnums) ReadField5(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v8, err9 := iprot.ReadI32()
	if err9 != nil {
		return thrift.NewTProtocolExceptionReadField(5, "optional_fifth", p.ThriftName(), err9)
	}
	p.OptionalFifth = DefinedValues(v8)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例8: ReadField6

func (p *ContainerOfEnums) ReadField6(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v10, err11 := iprot.ReadI32()
	if err11 != nil {
		return thrift.NewTProtocolExceptionReadField(6, "optional_sixth", p.ThriftName(), err11)
	}
	p.OptionalSixth = HeterogeneousValues(v10)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例9: ReadField2

func (p *Reservation) ReadField2(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v2, err3 := iprot.ReadString()
	if err3 != nil {
		return thrift.NewTProtocolExceptionReadField(2, "secret", p.ThriftName(), err3)
	}
	p.Secret = v2
	return err
}
開發者ID:paulcnichols,項目名稱:BigSelect,代碼行數:8,代碼來源:ttypes.go

示例10: ReadField1

func (p *Reservation) ReadField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v0, err1 := iprot.ReadString()
	if err1 != nil {
		return thrift.NewTProtocolExceptionReadField(1, "queue", p.ThriftName(), err1)
	}
	p.Queue = v0
	return err
}
開發者ID:paulcnichols,項目名稱:BigSelect,代碼行數:8,代碼來源:ttypes.go

示例11: ReadField8

func (p *ContainerOfEnums) ReadField8(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v14, err15 := iprot.ReadI32()
	if err15 != nil {
		return thrift.NewTProtocolExceptionReadField(8, "default_eighth", p.ThriftName(), err15)
	}
	p.DefaultEighth = DefinedValues(v14)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例12: readField0

func (p *SecondServiceSecondtestStringResult) readField0(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 0: ", err)
	} else {
		p.Success = &v
	}
	return nil
}
開發者ID:sktzwhj,項目名稱:thrift-0.9.3,代碼行數:8,代碼來源:secondservice.go

示例13: ReadField9

func (p *ContainerOfEnums) ReadField9(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v16, err17 := iprot.ReadI32()
	if err17 != nil {
		return thrift.NewTProtocolExceptionReadField(9, "default_nineth", p.ThriftName(), err17)
	}
	p.DefaultNineth = HeterogeneousValues(v16)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go

示例14: readField1

func (p *SecondServiceSecondtestStringArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Thing = v
	}
	return nil
}
開發者ID:sktzwhj,項目名稱:thrift-0.9.3,代碼行數:8,代碼來源:secondservice.go

示例15: ReadField2

func (p *ContainerOfEnums) ReadField2(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v2, err3 := iprot.ReadI32()
	if err3 != nil {
		return thrift.NewTProtocolExceptionReadField(2, "second", p.ThriftName(), err3)
	}
	p.Second = DefinedValues(v2)
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:8,代碼來源:ttypes.go


注:本文中的thrift.TProtocol類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。