本文整理匯總了Golang中git-wip-us/apache/org/repos/asf/thrift/git/lib/go/thrift.TProtocol.ReadListBegin方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.ReadListBegin方法的具體用法?Golang TProtocol.ReadListBegin怎麽用?Golang TProtocol.ReadListBegin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類git-wip-us/apache/org/repos/asf/thrift/git/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.ReadListBegin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: readField0
func (p *FetchResult) readField0(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return fmt.Errorf("error reading list being: %s")
}
p.Success = make([]*Contact, 0, size)
for i := 0; i < size; i++ {
_elem26 := NewContact()
if err := _elem26.Read(iprot); err != nil {
return fmt.Errorf("%T error reading struct: %s", _elem26)
}
p.Success = append(p.Success, _elem26)
}
if err := iprot.ReadListEnd(); err != nil {
return fmt.Errorf("error reading list end: %s")
}
return nil
}
示例2: ReadField1
func (p *LogArgs) ReadField1(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return fmt.Errorf("error reading list begin: %s", err)
}
tSlice := make([]*LogEntry, 0, size)
p.Messages = tSlice
for i := 0; i < size; i++ {
_elem4 := &LogEntry{}
if err := _elem4.Read(iprot); err != nil {
return fmt.Errorf("%T error reading struct: %s", _elem4, err)
}
p.Messages = append(p.Messages, _elem4)
}
if err := iprot.ReadListEnd(); err != nil {
return fmt.Errorf("error reading list end: %s", err)
}
return nil
}