本文整理匯總了Golang中google/golang.org/api/drive/v2.FilesListCall.Do方法的典型用法代碼示例。如果您正苦於以下問題:Golang FilesListCall.Do方法的具體用法?Golang FilesListCall.Do怎麽用?Golang FilesListCall.Do使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類google/golang.org/api/drive/v2.FilesListCall
的用法示例。
在下文中一共展示了FilesListCall.Do方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: _reqDoPage
func _reqDoPage(req *drive.FilesListCall, hidden bool, promptOnPagination, nilOnNoMatch bool) *paginationPair {
filesChan := make(chan *File)
errsChan := make(chan error)
throttle := time.Tick(1e8)
go func() {
defer func() {
close(errsChan)
close(filesChan)
}()
pageToken := ""
for pageIterCount := uint64(0); ; pageIterCount++ {
if pageToken != "" {
req = req.PageToken(pageToken)
}
results, err := req.Do()
if err != nil {
errsChan <- err
break
}
iterCount := uint64(0)
for _, f := range results.Items {
if isHidden(f.Title, hidden) { // ignore hidden files
continue
}
iterCount += 1
filesChan <- NewRemoteFile(f)
}
pageToken = results.NextPageToken
if pageToken == "" {
if nilOnNoMatch && len(results.Items) < 1 && pageIterCount < 1 {
// Item absolutely doesn't exist
filesChan <- nil
}
break
}
<-throttle
if iterCount < 1 {
continue
}
if promptOnPagination && !nextPage() {
filesChan <- nil
break
}
}
}()
return &paginationPair{filesChan: filesChan, errsChan: errsChan}
}
示例2: reqDoPage
func reqDoPage(req *drive.FilesListCall, hidden bool, promptOnPagination bool) chan *File {
fileChan := make(chan *File)
throttle := time.Tick(1e7)
go func() {
defer close(fileChan)
pageToken := ""
for {
if pageToken != "" {
req = req.PageToken(pageToken)
}
results, err := req.Do()
if err != nil {
fmt.Println(err)
break
}
iterCount := uint64(0)
for _, f := range results.Items {
if isHidden(f.Title, hidden) { // ignore hidden files
continue
}
iterCount += 1
fileChan <- NewRemoteFile(f)
}
pageToken = results.NextPageToken
if pageToken == "" {
break
}
if iterCount < 1 {
<-throttle
continue
}
if promptOnPagination && !nextPage() {
fileChan <- nil
break
}
}
}()
return fileChan
}