Add try_from_sqlx_postgres_row_to_proxy_row
First, thanks for the nice library, I enjoy using it. :)
One papercut is, as it is now, sea_orm::from_sqlx_postgres_row_to_proxy_row will panic on this line if a type is returned that doesn't find a match:
https://github.com/SeaQL/sea-orm/blob/4d0dcdc8ac279aaa09a7c78499dd946f9799f8cc/src/driver/sqlx_postgres.rs#L929
Would be nice(r) if there was a try_from_sqlx_postgres_row_to_proxy_row variant that wouldn't crash but return an error instead, where the given instance may have custom types defined from extension modules in my case.
hi, thanks for the thread. can you elaborate more on the proxy use case? it's mainly community contributed and I don't use it that much.
I am open to ideas to improve it meaningfully, would be great if you can provide more context around it.
Hi, sure thing.
I basically need to run raw sql and convert resulting Vec<QueryResult> into Vec<serde_json::Value>. And from_sqlx_postgres_row_to_proxy_row is a way to get it into a ProxyRow that then plays nicely with sea_orm::JsonValue::from<ProxyRow>
There is no other way that I can see to get a QueryResult into a serde_json::Value. But I'm perhaps good at overlooking something obvious. 😅
Edit: Also note I've worked around it easily enough by using the std::panic::catch_unwind, so it's not too pressing. :)
Oh, further note after digging some more, I thought JsonValue::find_by_statement would work - but it's arguably worse. Instead of raising any error, it returns empty rows. Suspect it's swallowing the same error in converting an unknown type within the row and just returning an empty row.