pub async fn get_user_by_id(pool: &Pool<MySql>, id: i64) -> Result<User>Expand description
Retrieves a specific user by their unique identifier.
This function fetches detailed information about a single user record. It’s typically used when specific user details are needed, such as for displaying user profiles or performing user-specific operations.
§Arguments
pool- Database connection pool for executing the queryid- Unique identifier of the user to retrieve
§Returns
Ok(User)- Successfully retrieved user informationErr(anyhow::Error)- Failed to fetch user (including if not found)
§Error Handling
Returns an error if no user with the given ID exists or if a database error occurs during the query execution.