pub async fn find_person_by_id(id: i32, pool: &PgPool) -> sqlx::Result<Person> {

    let person = sqlx::query("SELECT * FROM persons WHERE id = $1;")
        .bind(id)
        .map(|row: PgRow| Person {
            id: row.get(0),
            full_name: row.get(1),
        })
        .fetch_one(pool)
        .await?;

    tracing::info!(
        "db : Personne trouvée : {}",
        &person.full_name
    );
    Ok(person)
}
///
/// find person by id
/// used as help function for others
///

find person by id
used as help function for others
find person by id used as help function for others
pub async fn find_person_by_id(id: i32, pool: &PgPool) -> sqlx::Result<Person> {
    let person = sqlx::query("SELECT * FROM persons WHERE id = $1;")
        .bind(id)
        .map(|row: PgRow| Person {
            id: row.get(0),
            full_name: row.get(1),
        })
        .fetch_one(pool)
        .await?;
    tracing::info!(
        "db : Personne trouvée : {}",
        &person.full_name
    );
    Ok(person)
}
pub async fn find_person_by_id ( id : i32 , pool : & PgPool ) -> sqlx :: Result < Person > { let person = sqlx :: query ( " " ) . bind ( id ) . map ( | row : PgRow | Person { id : row . get ( 0 ) , full_name : row . get ( 1 ) , } ) . fetch_one ( pool ) . await ? ; tracing :: info ! ( " , person full_name ) ; Ok ( person ) }
find person by id
used as help function for others
find person by id used as help function for others
id
i32
pool
&PgPool