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
I wanted to pass a Vec<State> into a query to filter against several options. I've tried using both join unnest($1::state[]) state using (state) and = any($1::state[]), but I don't think it makes any difference.
If I try to pass it directly, the compiler complains that Vec<State>: !Type<Postgres>, so I looked at the docs to see if there's alternatives and found the impl for Vec<(T,)>, so I tried with Vec<(State,)>, but that errors because (State,): !Encode<'_, Postgres>.
For now, my solution is to map the enum variants to &'static str before passing them in.
The text was updated successfully, but these errors were encountered:
Ah, my bad, I was searching specifically for enum when looking for potential duplicates.
Must've overlooked that one because of the title because it does mention enums in the body text, now that I look at it.
I have this enum:
I wanted to pass a
Vec<State>
into a query to filter against several options. I've tried using bothjoin unnest($1::state[]) state using (state)
and= any($1::state[])
, but I don't think it makes any difference.If I try to pass it directly, the compiler complains that
Vec<State>: !Type<Postgres>
, so I looked at the docs to see if there's alternatives and found the impl forVec<(T,)>
, so I tried withVec<(State,)>
, but that errors because(State,): !Encode<'_, Postgres>
.For now, my solution is to map the enum variants to
&'static str
before passing them in.The text was updated successfully, but these errors were encountered: