本文整理汇总了Golang中git/apache/org/thrift/git/lib/go/thrift.TProtocol.WriteI16方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.WriteI16方法的具体用法?Golang TProtocol.WriteI16怎么用?Golang TProtocol.WriteI16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git/apache/org/thrift/git/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.WriteI16方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: writeField1
func (p *Flop) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("a", thrift.I16, 1); err != nil {
return fmt.Errorf("%T write field begin error 1:a: %s", p, err)
}
if err := oprot.WriteI16(int16(p.A)); err != nil {
return fmt.Errorf("%T.a (1) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 1:a: %s", p, err)
}
return err
}
示例2: writeField2
func (p *Flop) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("b", thrift.I16, 2); err != nil {
return fmt.Errorf("%T write field begin error 2:b: %s", p, err)
}
if err := oprot.WriteI16(int16(p.B)); err != nil {
return fmt.Errorf("%T.b (2) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 2:b: %s", p, err)
}
return err
}
示例3: writeField1
func (p *Types) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("short_value", thrift.I16, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:short_value: ", p), err)
}
if err := oprot.WriteI16(int16(p.ShortValue)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.short_value (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:short_value: ", p), err)
}
return err
}
示例4: writeField2
func (p *Message) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("vote_type", thrift.I16, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vote_type: ", p), err)
}
if err := oprot.WriteI16(int16(p.VoteType)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.vote_type (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vote_type: ", p), err)
}
return err
}
示例5: writeField4
func (p *Student) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("sage", thrift.I16, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:sage: ", p), err)
}
if err := oprot.WriteI16(int16(p.Sage)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.sage (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:sage: ", p), err)
}
return err
}
示例6: writeField2
func (p *Endpoint) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("port", thrift.I16, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:port: ", p), err)
}
if err := oprot.WriteI16(int16(p.Port)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.port (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:port: ", p), err)
}
return err
}
示例7: writeField2
func (p *GetArgs) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("columnId", thrift.I16, 2); err != nil {
return fmt.Errorf("%T write field begin error 2:columnId: %s", p, err)
}
if err := oprot.WriteI16(int16(p.ColumnId)); err != nil {
return fmt.Errorf("%T.columnId (2) field write error: %s", p)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 2:columnId: %s", p, err)
}
return err
}
示例8: writeField5
func (p *Person) writeField5(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("age", thrift.I16, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:age: ", p), err)
}
if err := oprot.WriteI16(int16(p.Age)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.age (5) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 5:age: ", p), err)
}
return err
}
示例9: writeField0
func (p *CountResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin("success", thrift.I16, 0); err != nil {
return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
}
if err := oprot.WriteI16(int16(*p.Success)); err != nil {
return fmt.Errorf("%T.success (0) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 0:success: %s", p, err)
}
}
return err
}