本文整理汇总了Golang中github.com/sipin/gothrift/thrift.TProtocol类的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol类的具体用法?Golang TProtocol怎么用?Golang TProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Read
func (p *UserGroup) 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
}
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: readField13
func (p *User) readField13(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 13: %s", err)
} else {
p.OrganizationID = v
}
return nil
}
示例3: readField14
func (p *User) readField14(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 14: %s", err)
} else {
p.Gender = v
}
return nil
}
示例4: readField1
func (p *UserGroup) readField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 1: %s", err)
} else {
p.ID = bson.ObjectId(v)
}
return nil
}
示例5: readField2
func (p *UserGroup) readField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return fmt.Errorf("error reading field 2: %s", err)
} else {
p.Name = v
}
return nil
}
示例6: readField9
func (p *User) readField9(iprot thrift.TProtocol) error {
if v, err := iprot.ReadBool(); err != nil {
return fmt.Errorf("error reading field 9: %s", err)
} else {
p.IsAdmin = v
}
return nil
}
示例7: readField15
func (p *User) readField15(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return fmt.Errorf("error reading field 15: %s", err)
} else {
p.Index = v
}
return nil
}
示例8: Write
func (p *User) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("User"); err != nil {
return fmt.Errorf("%T write struct begin error: %s", p, err)
}
if err := p.writeField1(oprot); err != nil {
return err
}
if err := p.writeField2(oprot); err != nil {
return err
}
if err := p.writeField3(oprot); err != nil {
return err
}
if err := p.writeField4(oprot); err != nil {
return err
}
if err := p.writeField5(oprot); err != nil {
return err
}
if err := p.writeField6(oprot); err != nil {
return err
}
if err := p.writeField7(oprot); err != nil {
return err
}
if err := p.writeField8(oprot); err != nil {
return err
}
if err := p.writeField9(oprot); err != nil {
return err
}
if err := p.writeField10(oprot); err != nil {
return err
}
if err := p.writeField11(oprot); err != nil {
return err
}
if err := p.writeField12(oprot); err != nil {
return err
}
if err := p.writeField13(oprot); err != nil {
return err
}
if err := p.writeField14(oprot); err != nil {
return err
}
if err := p.writeField15(oprot); err != nil {
return err
}
if err := oprot.WriteFieldStop(); err != nil {
return fmt.Errorf("write field stop error: %s", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return fmt.Errorf("write struct stop error: %s", err)
}
return nil
}
示例9: writeField2
func (p *UserGroup) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("Name", thrift.STRING, 2); err != nil {
return fmt.Errorf("%T write field begin error 2:Name: %s", p, err)
}
if err := oprot.WriteString(string(p.Name)); err != nil {
return fmt.Errorf("%T.Name (2) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 2:Name: %s", p, err)
}
return err
}
示例10: writeField15
func (p *User) writeField15(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("Index", thrift.I32, 15); err != nil {
return fmt.Errorf("%T write field begin error 15:Index: %s", p, err)
}
if err := oprot.WriteI32(int32(p.Index)); err != nil {
return fmt.Errorf("%T.Index (15) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 15:Index: %s", p, err)
}
return err
}
示例11: writeField14
func (p *User) writeField14(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("Gender", thrift.STRING, 14); err != nil {
return fmt.Errorf("%T write field begin error 14:Gender: %s", p, err)
}
if err := oprot.WriteString(string(p.Gender)); err != nil {
return fmt.Errorf("%T.Gender (14) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 14:Gender: %s", p, err)
}
return err
}
示例12: writeField5
func (p *User) writeField5(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("Email", thrift.STRING, 5); err != nil {
return fmt.Errorf("%T write field begin error 5:Email: %s", p, err)
}
if err := oprot.WriteString(string(p.Email)); err != nil {
return fmt.Errorf("%T.Email (5) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 5:Email: %s", p, err)
}
return err
}
示例13: writeField13
func (p *User) writeField13(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("OrganizationID", thrift.STRING, 13); err != nil {
return fmt.Errorf("%T write field begin error 13:OrganizationID: %s", p, err)
}
if err := oprot.WriteString(string(p.OrganizationID)); err != nil {
return fmt.Errorf("%T.OrganizationID (13) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 13:OrganizationID: %s", p, err)
}
return err
}
示例14: writeField6
func (p *User) writeField6(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("Intro", thrift.STRING, 6); err != nil {
return fmt.Errorf("%T write field begin error 6:Intro: %s", p, err)
}
if err := oprot.WriteString(string(p.Intro)); err != nil {
return fmt.Errorf("%T.Intro (6) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 6:Intro: %s", p, err)
}
return err
}
示例15: writeField12
func (p *User) writeField12(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("PubInfoID", thrift.STRING, 12); err != nil {
return fmt.Errorf("%T write field begin error 12:PubInfoID: %s", p, err)
}
if err := oprot.WriteString(string(p.PubInfoID)); err != nil {
return fmt.Errorf("%T.PubInfoID (12) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 12:PubInfoID: %s", p, err)
}
return err
}