-
Hello everyone, impl From<Row> for User {
fn from(row: Row) -> Self {
Self {
id: row.get("id"),
name: row.get("name"),
email: row.get("email"),
}
}
} sqlx generates function with lifetime and anonymous type: impl FromRow for User {
fn from_row(row: &'r R) -> Result<Self, sqlx::Error> {
todo!()
}
} Would be grateful if someone explains how to make it up, or even just share an example of working one) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
UPD: I've found type that should be used instead of |
Beta Was this translation helpful? Give feedback.
UPD: I've found type that should be used instead of
R
. If you use Postgresql - it'sPgRow
. However it did not help with checked queries, I guess query type check is done at some other point, so it fails to compile.