Closed guspower closed 3 months ago
What are those f32's supposed to correspond to? Are they individual parameters to the query? A single array parameter?
They are individual parameters to the query (not an array parameter).
f32 already implements ToSql. The issue is that you are passing a &[f32]
to a function taking &[&dyn ToSql]
, and those are not the same type.
You can either make a new slice with that type, or use the lower-level query_raw method which should be able to work with the float slice.
TIL: query_raw
works perfectly, thank you +!
I am trying to provide a
&[f32]
as params toexecute
(an output from a Pearson correlation inndarray-stats
). I get the following build error:I considered wrapping
f32
in a custom type that implementsToSql
but that seems like overkill. After re-reading the docs I enabled thearray-impls
feature to see if that would get me any further. I can see that there is aToSql
impl forf32
, but I could do with some pointers about the most sensible way forward!Thanks for your help + super useful library.