本文整理匯總了Golang中github.com/apache/thrift/lib/go/thrift.TProtocol.WriteMapEnd方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.WriteMapEnd方法的具體用法?Golang TProtocol.WriteMapEnd怎麽用?Golang TProtocol.WriteMapEnd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/apache/thrift/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.WriteMapEnd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: writeField1
func (p *ThriftIDLs) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("idls", thrift.MAP, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:idls: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Idls)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.Idls {
if err := oprot.WriteString(string(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteString(string(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 1:idls: ", p), err)
}
return err
}
示例2: 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
}