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

Feature request: impl AppenderParams for tuples up to certain arity #449

Open
rben01 opened this issue Feb 28, 2025 · 0 comments
Open

Feature request: impl AppenderParams for tuples up to certain arity #449

rben01 opened this issue Feb 28, 2025 · 0 comments

Comments

@rben01
Copy link

rben01 commented Feb 28, 2025

Passing data to Appender::append_rows is not as easy as it could be. If your data is heterogenous, then you cannot put it in an array. But using params![] correctly can be tricky due to lifetime issues caused by the references. For instance, you can't call appender.append_rows(iterator.map(|(foo, bar)| params![foo, bar])) because foo and bar are owned by the closure and therefore will not live as long as the references created by params. If foo and bar are themselves references, then you can manually write out [foo as &dyn ToSql, bar as &dyn toSql], but this is inconvenient compared to params!.

Ideally, AppenderParams would be implemented for tuples of ToSql up to some arity. This would allow users to easily pass heterogenous data to an Appender.

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