user: get one by id
This commit is contained in:
parent
5404fb1cf8
commit
e04de752ef
4 changed files with 111 additions and 0 deletions
|
|
@ -41,4 +41,14 @@ impl Users {
|
|||
|
||||
Ok((query.rows_affected() == 1).then_some(()))
|
||||
}
|
||||
|
||||
pub async fn get_one_by_id(
|
||||
conn: impl SqliteExecutor<'_>,
|
||||
id: &str,
|
||||
) -> Result<Option<Self>, Error> {
|
||||
sqlx::query_file_as!(Self, "queries/users/get_one_by_id.sql", id)
|
||||
.fetch_optional(conn)
|
||||
.await
|
||||
.map_err(handle_error)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue