You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 usingparams![]
correctly can be tricky due to lifetime issues caused by the references. For instance, you can't callappender.append_rows(iterator.map(|(foo, bar)| params![foo, bar]))
becausefoo
andbar
are owned by the closure and therefore will not live as long as the references created byparams
. Iffoo
andbar
are themselves references, then you can manually write out[foo as &dyn ToSql, bar as &dyn toSql]
, but this is inconvenient compared toparams!
.Ideally,
AppenderParams
would be implemented for tuples ofToSql
up to some arity. This would allow users to easily pass heterogenous data to anAppender
.The text was updated successfully, but these errors were encountered: