I have the following code:
use sqlx::mysql::*;
mod db;
#[tokio::main]
async fn main() -> Result<(), sqlx::Error> {
println!("Hello, world!");
let pool = MySqlPoolOptions::new()
.max_connections(5)
.connect("connection-string").await?;
#[derive(Debug, PartialEq, Eq)]
struct Room {
name: String
}
let mut rooms: Vec<Room> = vec![];
let mut stream = sqlx::query("SELECT name FROM rooms")
.map(|row: MySqlRow| {
// map the row into a user-defined domain type
//rooms.push( Room { row.name } );
println!("Tester print");
})
.fetch(&pool);
println!("{:?}", rooms);
Ok(())
}
it seems to connect, it doesnt error out, but its not getting any data, or at least the print inside the map function is not getting executed. Anyone know why?