当前位置: 首页>>代码示例>>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;未经允许,请勿转载。