filterbar wip

This commit is contained in:
Robin Appelman 2023-04-11 23:06:48 +02:00
commit e5c9aeb7fe
15 changed files with 1905 additions and 420 deletions

19
src/data/maps.rs Normal file
View file

@ -0,0 +1,19 @@
use crate::Result;
use sqlx::{query, Executor, Postgres};
use tracing::instrument;
#[instrument(skip(connection))]
pub async fn map_list(
connection: impl Executor<'_, Database = Postgres>,
) -> Result<impl Iterator<Item = String>> {
Ok(query!(
r#"SELECT
map as "map!"
FROM map_list
ORDER BY count DESC LIMIT 50"#
)
.fetch_all(connection)
.await?
.into_iter()
.map(|res| res.map))
}

View file

@ -1,5 +1,6 @@
pub mod chat;
pub mod demo;
pub mod maps;
pub mod player;
pub mod steam_id;
pub mod user;