本文整理匯總了Golang中github.com/apache/thrift/lib/go/thrift.TProtocol.WriteBinary方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.WriteBinary方法的具體用法?Golang TProtocol.WriteBinary怎麽用?Golang TProtocol.WriteBinary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/apache/thrift/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.WriteBinary方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: writeField5
func (p *Span) writeField5(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("parentId", thrift.STRING, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:parentId: ", p), err)
}
if err := oprot.WriteBinary(p.ParentId); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.parentId (5) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 5:parentId: ", p), err)
}
return err
}
示例2: writeField2
func (p *BinaryAnnotation) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err)
}
if err := oprot.WriteBinary(p.Value); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err)
}
return err
}
示例3: writeField4
func (p *Span) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("id", thrift.STRING, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:id: ", p), err)
}
if err := oprot.WriteBinary(p.ID); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.id (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:id: ", p), err)
}
return err
}
示例4: writeField1
func (p *Span) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("traceId", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceId: ", p), err)
}
if err := oprot.WriteBinary(p.TraceId); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.traceId (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceId: ", p), err)
}
return err
}
示例5: writeField4
func (p *Span) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("id", thrift.STRING, 4); err != nil {
return fmt.Errorf("%T write field begin error 4:id: %s", p, err)
}
if err := oprot.WriteBinary(p.Id); err != nil {
return fmt.Errorf("%T.id (4) field write error: %s", p, err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return fmt.Errorf("%T write field end error 4:id: %s", p, err)
}
return err
}
示例6: writeField3
func (p *Spec) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("blobs", thrift.MAP, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:blobs: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Blobs)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.Blobs {
if err := oprot.WriteString(string(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteBinary(v); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
}
if err := oprot.WriteMapEnd(); err != nil {
return thrift.PrependError("error writing map end: ", err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:blobs: ", p), err)
}
return err
}