diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-12 22:52:15 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-12 22:52:15 +0200 |
commit | ae57359353cf31ff374a8932999742920878bf00 (patch) | |
tree | 0db27d394a2a61a5cc94e73014c82954829c1338 /planetwars-server/src/db/ratings.rs | |
parent | ed016773b112460ebbf0ff023b0915545229ed41 (diff) | |
download | planetwars.dev-ae57359353cf31ff374a8932999742920878bf00.tar.xz planetwars.dev-ae57359353cf31ff374a8932999742920878bf00.zip |
upgrade to diesel 2.0
Diffstat (limited to 'planetwars-server/src/db/ratings.rs')
-rw-r--r-- | planetwars-server/src/db/ratings.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<Option<f64>> { +pub fn get_rating(bot_id: i32, db_conn: &mut PgConnection) -> QueryResult<Option<f64>> { 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<Option<f64 .optional() } -pub fn set_rating(bot_id: i32, rating: f64, db_conn: &PgConnection) -> QueryResult<usize> { +pub fn set_rating(bot_id: i32, rating: f64, db_conn: &mut PgConnection) -> QueryResult<usize> { 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<Vec<RankedBot>> { +pub fn get_bot_ranking(db_conn: &mut PgConnection) -> QueryResult<Vec<RankedBot>> { bots::table .left_join(users::table) .inner_join(ratings::table) |