本文整理匯總了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
}