async fn name_exists(name: &str, pg: &PgPool) -> Result<bool> {
    let name = name.trim();

    let record = sqlx::query!(
        r#"select exists (select 1 from players where name = $1)"#,
        name
    )
    .fetch_one(&*pg)
    .await;

    match record {
        Ok(record) => Ok(matches!(record.exists, Some(true))),
        Err(_) => Ok(false),
    }
}
/// Returns whether a player exists or not (via name).
Returns whether a player exists or not (via name).
Returns whether a player exists or not ( via name ) .
async fn name_exists(name: &str, pg: &PgPool) -> Result<bool> {
    let name = name.trim();
    let record = sqlx::query!(
        r#"select exists (select 1 from players where name = $1)"#,
        name
    )
    .fetch_one(&*pg)
    .await;
    match record {
        Ok(record) => Ok(matches!(record.exists, Some(true))),
        Err(_) => Ok(false),
    }
}
async fn name_exists ( name : & str , pg : & PgPool ) -> Result < bool > { let name = name . trim ( ) ; let record = sqlx :: query ! ( r#"select exists (select 1 from players where name = $1)"# name ) . fetch_one ( & * pg ) . await ; match record { Ok ( record ) => Ok ( matches ! ( record exists Some ( true ) ) ) , Err ( _ ) => Ok ( false ) , } }
Returns whether a player exists or not (via name).
Returns whether a player exists or not ( via name ) .
name
&str
pg
&PgPool
name
&str
pg
&PgPool