本文整理汇总了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}