pub async fn list_genres(pool: &PgPool) -> anyhow::Result<Vec<Genre>> {

    let genres: Vec<Genre> =
        sqlx::query("SELECT id, name FROM genres ORDER BY name;")
            .map(|row: PgRow| Genre {
                id: row.get(0),
                name: row.get(1),
            })
            .fetch_all(pool)
            .await?;
    Ok(genres)
}
///
/// Returns a list of genres
/// under the form of a Vec<Genre>
/// or a sqlx Error
///

Returns a list of genres
under the form of a Vec
or a sqlx Error
Returns a list of genres under the form of a Vec or a sqlx Error
pub async fn list_genres(pool: &PgPool) -> anyhow::Result<Vec<Genre>> {
    let genres: Vec<Genre> =
        sqlx::query("SELECT id, name FROM genres ORDER BY name;")
            .map(|row: PgRow| Genre {
                id: row.get(0),
                name: row.get(1),
            })
            .fetch_all(pool)
            .await?;
    Ok(genres)
}
pub async fn list_genres ( pool : & PgPool ) -> anyhow :: Result < Vec < Genre > > { let genres : Vec < Genre > = sqlx :: query ( " " ) . map ( | row : PgRow | Genre { id : row . get ( 0 ) , name : row . get ( 1 ) , } ) . fetch_all ( pool ) . await ? ; Ok ( genres ) }
Returns a list of genres
under the form of a Vec<Genre>
or a sqlx Error
Returns a list of genres under the form of a Vec<Genre > or a sqlx Error
pool
&PgPool