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

async fn query should take a reference to a query, not the query instance itself #54

Open
BRA1L0R opened this issue Feb 8, 2024 · 3 comments

Comments

@BRA1L0R
Copy link

BRA1L0R commented Feb 8, 2024

https://github.com/aprimadi/influxdb2/blob/11b8b9d23568d09672cf8ed85b7d878c0deaa8e4/src/api/query.rs#L100C57-L100C62

I think it's useless for it to take ownership of the query. A reference should work just fine. This way i can lazily initialize my query object and reuse a reference to it over and over.

@Boudewijn26
Copy link
Collaborator

I think that's a valid point, we'd greatly appreciate a PR which makes that change.

That would be a backwards incompatible API change, which warrants a new minor version (since we're still at 0.x) instead of a patch bump

@BRA1L0R
Copy link
Author

BRA1L0R commented Feb 10, 2024

@Boudewijn26 would it be better to accept an Option<impl Borrow<Query>> to maintain a certain level of compatibility for the API or Option<&Query>?

@Boudewijn26
Copy link
Collaborator

Thanks for the suggestion. I must admit I didn't yet know about the Borrow trait. Which is a shame, given how useful it clearly is. The Option<impl Borrow<Query>> is very much the preferred route

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

2 participants