本文整理匯總了Golang中github.com/upfluence/goutils/Godeps/_workspace/src/github.com/upfluence/thrift/lib/go/thrift.TProtocol.ReadMapBegin方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.ReadMapBegin方法的具體用法?Golang TProtocol.ReadMapBegin怎麽用?Golang TProtocol.ReadMapBegin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/upfluence/goutils/Godeps/_workspace/src/github.com/upfluence/thrift/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.ReadMapBegin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReadField0
func (p *BaseServiceGetInterfaceVersionsResult) ReadField0(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[string]*version.Version, size)
p.Success = tMap
for i := 0; i < size; i++ {
var _key12 string
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key12 = v
}
_val13 := version.NewVersion()
if err := _val13.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val13), err)
}
p.Success[_key12] = _val13
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
示例2: ReadField0
func (p *MonitoringCollectResult) ReadField0(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(Metrics, size)
p.Success = tMap
for i := 0; i < size; i++ {
var _key5 MetricID
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := MetricID(v)
_key5 = temp
}
var _val6 float64
if v, err := iprot.ReadDouble(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_val6 = v
}
p.Success[_key5] = _val6
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}