[GODRIVER-2153] page iterator support Created: 14/Sep/21  Updated: 30/Mar/22

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: du liu Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: post-1.8.0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Would driver can implement  the `page iterator`?  It may faster than `iterator`.

I tried the `BatchSize` param in `cursor`, but it does not seem to be applicable in this scenario.



 Comments   
Comment by Kevin Albertson [ 27/Sep/21 ]

Hello mrliuxiansen8023@gmail.com, thank you for your patience. We will come back to this investigation after we completed urgent work for an upcoming release.

Comment by du liu [ 15/Sep/21 ]

Hi Kevin, Thanks for your replay.

I get this idea by reading `iterator` of `google api`.I want to specify a `page` like

type PageInfo struct {
        // iterator package - google.golang.org/api/iterator - pkg.go.dev
	// Token is the token used to retrieve the next page of items from the
	// API. You may set Token immediately after creating an iterator to
	// begin iteration at a particular point. If Token is the empty string,
	// the iterator will begin with the first eligible item.
	//
	// The result of setting Token after the first call to Next is undefined.
	//
	// After the underlying API method is called to retrieve a page of items,
	// Token is set to the next-page token in the response.
	Token string
 
	// MaxSize is the maximum number of items returned by a call to the API.
	// Set MaxSize as a hint to optimize the buffering behavior of the iterator.
	// If zero, the page size is determined by the underlying service.
	//
	// Use Pager to retrieve a page of a specific, exact size.
	MaxSize int
	// contains filtered or unexported fields
}

Then I can get a `slice response` of items which I search.It sounds like `query page`. But it seems like easyer than `query page`. Because I don't need to cover `skip` and `limit`.

 

This is url: iterator package - google.golang.org/api/iterator - pkg.go.dev

And here is wiki: Iterator Guidelines · googleapis/google-cloud-go Wiki (github.com)

 

Best Wishes,

刘笃

 

Comment by Kevin Albertson [ 14/Sep/21 ]

Hi mrliuxiansen8023@gmail.com, thank you for the request! Can you clarify what you mean by "page iterator" and "iterator"? If possible, please include a code snippet for how the desired feature would behave.

Sincerely,

Kevin 

Generated at Thu Feb 08 08:37:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.