From ae57359353cf31ff374a8932999742920878bf00 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Wed, 12 Oct 2022 22:52:15 +0200 Subject: upgrade to diesel 2.0 --- planetwars-server/src/db/ratings.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'planetwars-server/src/db/ratings.rs') diff --git a/planetwars-server/src/db/ratings.rs b/planetwars-server/src/db/ratings.rs index 8262fed..0a510d4 100644 --- a/planetwars-server/src/db/ratings.rs +++ b/planetwars-server/src/db/ratings.rs @@ -10,7 +10,7 @@ pub struct Rating { pub rating: f64, } -pub fn get_rating(bot_id: i32, db_conn: &PgConnection) -> QueryResult> { +pub fn get_rating(bot_id: i32, db_conn: &mut PgConnection) -> QueryResult> { ratings::table .filter(ratings::bot_id.eq(bot_id)) .select(ratings::rating) @@ -18,7 +18,7 @@ pub fn get_rating(bot_id: i32, db_conn: &PgConnection) -> QueryResult QueryResult { +pub fn set_rating(bot_id: i32, rating: f64, db_conn: &mut PgConnection) -> QueryResult { diesel::insert_into(ratings::table) .values(Rating { bot_id, rating }) .on_conflict(ratings::bot_id) @@ -40,7 +40,7 @@ pub struct RankedBot { pub rating: f64, } -pub fn get_bot_ranking(db_conn: &PgConnection) -> QueryResult> { +pub fn get_bot_ranking(db_conn: &mut PgConnection) -> QueryResult> { bots::table .left_join(users::table) .inner_join(ratings::table) -- cgit v1.2.3