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

    let rep: Vec<ShowPartition>  =
        sqlx::query("
    SELECT partitions.id, partitions.title, persons.full_name, genres.name
    FROM partitions
    INNER JOIN persons
    ON partitions.person_id = persons.id
    INNER JOIN genres
    ON partitions.genre_id = genres.id
    ORDER BY partitions.title
        "
        ).map(|row: PgRow| ShowPartition {
            id: row.get(0),
            title: row.get(1),
            full_name: row.get(2),
            name: row.get(3),
        })
            .fetch_all(pool)
            .await?;
    Ok(rep)
}
///
/// Returns a list of all partitions in the db
/// under the form of a Vec<ShowPartition>
/// or a sqlx Error
///

Returns a list of all partitions in the db
under the form of a Vec
or a sqlx Error
Returns a list of all partitions in the db under the form of a Vec or a sqlx Error
pub async fn list_show_partitions(pool: &PgPool) -> anyhow::Result<Vec<ShowPartition>> {
    let rep: Vec<ShowPartition>  =
        sqlx::query("
    SELECT partitions.id, partitions.title, persons.full_name, genres.name
    FROM partitions
    INNER JOIN persons
    ON partitions.person_id = persons.id
    INNER JOIN genres
    ON partitions.genre_id = genres.id
    ORDER BY partitions.title
        "
        ).map(|row: PgRow| ShowPartition {
            id: row.get(0),
            title: row.get(1),
            full_name: row.get(2),
            name: row.get(3),
        })
            .fetch_all(pool)
            .await?;
    Ok(rep)
}
pub async fn list_show_partitions ( pool : & PgPool ) -> anyhow :: Result < Vec < ShowPartition > > { let rep : Vec < ShowPartition > = sqlx :: query ( " " ) . map ( | row : PgRow | ShowPartition { id : row . get ( 0 ) , title : row . get ( 1 ) , full_name : row . get ( 2 ) , name : row . get ( 3 ) , } ) . fetch_all ( pool ) . await ? ; Ok ( rep ) }
Returns a list of all partitions in the db
under the form of a Vec<ShowPartition>
or a sqlx Error
Returns a list of all partitions in the db under the form of a Vec<ShowPartition > or a sqlx Error
pool
&PgPool