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

pgx Module: Add support for handling query result sets with a passed func #294

Open
nickman opened this issue Nov 29, 2024 · 0 comments
Open

Comments

@nickman
Copy link

nickman commented Nov 29, 2024

Would like to contribute an enhancement to the pgx module where query returned rows can be handled by a passed func rather than returning the whole result set.

e.g.

p := pgx.connect("postgres://user:[email protected]:5432/db")
rcnt := p.queryFunc("SELECT * FROM generate_series($1::integer, $2::integer)", func(row) {
    return true
}, 1, 100000)
printf("rows returned: %d\n", rcnt)
p.close()

Some benefits when:

  • Processing large datasets, as it allows for processing each row as it is received from the database, rather than waiting for the entire result set to be returned.
  • When result set processing should be stopped based on a condition.

PR coming up.

nickman pushed a commit to nickman/risor that referenced this issue Nov 29, 2024
nickman pushed a commit to nickman/risor that referenced this issue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant