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

feat: Add QueryResultOwned type for lifetime-independent streaming #216

Open
wants to merge 2 commits into
base: async-await
Choose a base branch
from

Conversation

gengteng
Copy link

Implemented QueryResultOwned to solve lifetime issues encountered with streaming query results in asynchronous contexts. This type facilitates creating streams with 'static lifetimes, enabling easier integration into async workflows and structures that require static lifetime guarantees.

Key Changes:

  • Added QueryResultOwned for lifetime-independent query result streaming.
  • Ensured compatibility with existing streaming functionalities.

Background:
Developing async applications with the existing query streaming mechanism led to challenges due to Rust's strict lifetime requirements. Specifically, returning streams from async functions or storing them for later use was cumbersome because of lifetime ties to the client or query string.

Usage:

let query_result_owned = client.query_owned("SELECT * FROM table");
let stream = query_result_owned.stream(); // Stream with `'static` lifetime

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

Successfully merging this pull request may close these issues.

1 participant