AEWYJHUD6R45HG4BJSZGH32VJ25H6GU74CL5ZBKI647AKF22HY6QC
let player_list = if let Some(ref _user) = user {
let stmt = match dbclient.prepare("select p.player_name from games.players p where p.game_uid = $1 and p.client_type = 'p';").await {
Ok(stmt) => stmt,
Err(e) => {
log::error!("{}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let rows = match dbclient.query(&stmt, &[&gameuid]).await {
Ok(rows) => rows,
Err(e) => {
log::error!("{}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let mut users = Vec::with_capacity(rows.len());
for row in rows {
users.push(row.get::<_, String>(0));
}
Some(users)
} else {
None
};