Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] adding integrated pagination support in select query #3865

Open
mcarbonneaux opened this issue Feb 28, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@mcarbonneaux
Copy link

mcarbonneaux commented Feb 28, 2025

What do you want to change?

wil be very useful to add pagination on select query.
this avoid the need to be implemented with args.

with defined request like in example:

-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;

To be abel to use like this:

	// list all authors pagintated with page size of 10
        // behind the scene use count from select and divide by the size
        // and at each page use limit and offset to get the selected page
	pagedAuthors, err := queries.ListPaginatedAuthors(ctx,10)
	if err != nil {
		return err
	}
        // to loop pages
        pageMax := pagedAuthors.GetMaxPages()
        pagedAuthors.Reset()
        for pagenumber := 0; pagenumber  < pageMax; pagenumber ++ {
            authors := pagedAuthors.Next()
            log.Println(pagenumber)
     	    log.Println(authors)
        }
        // or the get specific page (the 2s page)
        authors := pagedAuthors.Get(2)
        log.Println(authors)

What database engines need to be changed?

any supported

What programming language backends need to be changed?

any language supported (my sample is in go)

@mcarbonneaux mcarbonneaux added the enhancement New feature or request label Feb 28, 2025
@mcarbonneaux mcarbonneaux changed the title [feature request] adding integreted pagination support in select query [feature request] adding integrated pagination support in select query Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant