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

Take IntoIterator rather than &[&ToSql]. #265

Closed
sfackler opened this issue Jun 8, 2017 · 1 comment · Fixed by #458
Closed

Take IntoIterator rather than &[&ToSql]. #265

sfackler opened this issue Jun 8, 2017 · 1 comment · Fixed by #458

Comments

@sfackler
Copy link
Owner

sfackler commented Jun 8, 2017

It might be pretty tricky to figure out the exact bounds that will work, but we don't need a slice of &ToSql specifically.

@elpiel
Copy link
Sponsor Contributor

elpiel commented Jun 13, 2019

Can you give a bit more information, I would like to try and implement this?

sfackler added a commit that referenced this issue Jul 10, 2019
The existing methods which take slices of parameters work well when
directly passing a temporary slice (e.g. `c.query(s, &[&15, &"hi"])`,
but becomes limiting in other contexts like when programmatically
building up a query. We now offer methods which take iterators, which
are significantly more flexible for these kinds of use cases.

Because of the weird object safety of `ToSql`, we can't be generic over
`Iterator<Item = impl ToSql>`, but instead have to specifically work
with `Iterator<Item = &dyn ToSql>`. This may require a `.map()` or two
but should still work fine.

Closes #265
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 a pull request may close this issue.

2 participants