Skip to content

Conversation

sfackler
Copy link
Owner

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

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 this pull request may close these issues.

Take IntoIterator rather than &[&ToSql].
1 participant