本文整理汇总了Golang中git-wip-us/apache/org/repos/asf/thrift/git/lib/go/thrift.TProtocol类的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol类的具体用法?Golang TProtocol怎么用?Golang TProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Read
func (p *ReadResult) 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: readField5
func (p *Contact) readField5(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 5: %s")
} else {
p.Created = v
}
return nil
}
示例3: ReadField1
func (p *Echo2timesArgs) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 1: %s", err)
} else {
p.String1 = v
}
return nil
}
示例4: ReadField0
func (p *Echo2timesResult) ReadField0(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 0: %s", err)
} else {
p.Success = &v
}
return nil
}
示例5: readField1
func (p *ReadArgs) readField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 1: %s")
} else {
p.ContactId = v
}
return nil
}
示例6: ReadField1
func (p *LogEntry) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 1: %s", err)
} else {
p.Hostname = v
}
return nil
}
示例7: ReadField3
func (p *RestResponse) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadBinary(); err != nil {
return fmt.Errorf("error reading field 3: %s", err)
} else {
p.Body = v
}
return nil
}
示例8: ReadField2
func (p *RestRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 2: %s", err)
} else {
p.Uri = v
}
return nil
}
示例9: ReadField1
func (p *RestResponse) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return fmt.Errorf("error reading field 1: %s", err)
} else {
temp := Status(v)
p.Status = temp
}
return nil
}
示例10: ReadField0
func (p *LogResult) ReadField0(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return fmt.Errorf("error reading field 0: %s", err)
} else {
temp := ResultCode(v)
p.Success = &temp
}
return nil
}
示例11: writeField1
func (p *ExecuteArgs) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil {
return fmt.Errorf("%T write field begin error 1:request: %s", p, err)
}
if err := p.Request.Write(oprot); err != nil {
return fmt.Errorf("%T error writing struct: %s", p.Request, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 1:request: %s", p, err)
}
return err
}
示例12: writeField1
func (p *CreateArgs) writeField1(oprot thrift.TProtocol) (err error) {
if p.Contact != nil {
if err := oprot.WriteFieldBegin("contact", thrift.STRUCT, 1); err != nil {
return fmt.Errorf("%T write field begin error 1:contact: %s", p, err)
}
if err := p.Contact.Write(oprot); err != nil {
return fmt.Errorf("%T error writing struct: %s", p.Contact)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 1:contact: %s", p, err)
}
}
return err
}
示例13: writeField0
func (p *CreateResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.Success != nil {
if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
}
if err := p.Success.Write(oprot); err != nil {
return fmt.Errorf("%T error writing struct: %s", p.Success)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 0:success: %s", p, err)
}
}
return err
}
示例14: Read
func (p *RestRequest) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return fmt.Errorf("%T read error: %s", p, err)
}
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 1:
if err := p.ReadField1(iprot); err != nil {
return err
}
case 2:
if err := p.ReadField2(iprot); err != nil {
return err
}
case 3:
if err := p.ReadField3(iprot); err != nil {
return err
}
case 4:
if err := p.ReadField4(iprot); err != nil {
return err
}
case 5:
if err := p.ReadField5(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
}
示例15: readField0
func (p *FetchResult) readField0(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return fmt.Errorf("error reading list being: %s")
}
p.Success = make([]*Contact, 0, size)
for i := 0; i < size; i++ {
_elem26 := NewContact()
if err := _elem26.Read(iprot); err != nil {
return fmt.Errorf("%T error reading struct: %s", _elem26)
}
p.Success = append(p.Success, _elem26)
}
if err := iprot.ReadListEnd(); err != nil {
return fmt.Errorf("error reading list end: %s")
}
return nil
}