本文整理汇总了Golang中github.com/apache/thrift/lib/go/thrift.TProtocol.ReadMapBegin方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.ReadMapBegin方法的具体用法?Golang TProtocol.ReadMapBegin怎么用?Golang TProtocol.ReadMapBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/apache/thrift/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.ReadMapBegin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: readField1
func (p *ThriftIDLs) readField1(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[Filename]string, size)
p.Idls = tMap
for i := 0; i < size; i++ {
var _key0 Filename
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := Filename(v)
_key0 = temp
}
var _val1 string
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_val1 = v
}
p.Idls[_key0] = _val1
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
示例2: ReadField3
func (p *Spec) ReadField3(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[string]ID, size)
p.Blobs = tMap
for i := 0; i < size; i++ {
var _key2 string
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key2 = v
}
var _val3 ID
if v, err := iprot.ReadBinary(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := ID(v)
_val3 = temp
}
p.Blobs[_key2] = _val3
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}