From a83ed030309b30c66f8b9cb72984c8564a7d434d Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Fri, 8 Sep 2023 16:17:45 -0700 Subject: [PATCH] bump sqlx to 0.7 --- Cargo.toml | 4 ++-- src/mysql.rs | 20 ++++++++++---------- src/pg.rs | 20 ++++++++++---------- src/sqlite.rs | 22 +++++++++++----------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b452a5d..e09748d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,12 +25,12 @@ mysql = ["sqlx/mysql", "sqlx/json"] [dependencies] async-session = "3.0.0" -sqlx = { version = "0.6.2", features = ["chrono"] } +sqlx = { version = "0.7.1", features = ["chrono"] } async-std = { version = "1.12.0", optional = true } [dev-dependencies] async-std = { version = "1.12.0", features = ["attributes"] } [dev-dependencies.sqlx] -version = "0.6.2" +version = "0.7.1" features = ["chrono", "runtime-async-std-native-tls"] diff --git a/src/mysql.rs b/src/mysql.rs index 0edf82c..d076ebb 100644 --- a/src/mysql.rs +++ b/src/mysql.rs @@ -235,7 +235,7 @@ impl MySqlSessionStore { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("DELETE FROM %%TABLE_NAME%% WHERE expires < ?")) .bind(Utc::now()) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -261,7 +261,7 @@ impl MySqlSessionStore { pub async fn count(&self) -> sqlx::Result { let (count,) = sqlx::query_as(&self.substitute_table_name("SELECT COUNT(*) FROM %%TABLE_NAME%%")) - .fetch_one(&mut self.connection().await?) + .fetch_one(&mut *self.connection().await?) .await?; Ok(count) @@ -279,7 +279,7 @@ impl SessionStore for MySqlSessionStore { )) .bind(&id) .bind(Utc::now()) - .fetch_optional(&mut connection) + .fetch_optional(&mut *connection) .await?; Ok(result @@ -304,7 +304,7 @@ impl SessionStore for MySqlSessionStore { .bind(&id) .bind(&string) .bind(&session.expiry()) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(session.into_cookie_value()) @@ -315,7 +315,7 @@ impl SessionStore for MySqlSessionStore { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("DELETE FROM %%TABLE_NAME%% WHERE id = ?")) .bind(&id) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -324,7 +324,7 @@ impl SessionStore for MySqlSessionStore { async fn clear_store(&self) -> Result { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("TRUNCATE %%TABLE_NAME%%")) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -362,7 +362,7 @@ mod tests { let (id, expires, serialized, count): (String, Option>, String, i64) = sqlx::query_as("select id, expires, session, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -399,7 +399,7 @@ mod tests { let (id, count): (String, i64) = sqlx::query_as("select id, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -429,7 +429,7 @@ mod tests { let (id, expires, count): (String, DateTime, i64) = sqlx::query_as( "select id, expires, (select count(*) from async_sessions) from async_sessions", ) - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -451,7 +451,7 @@ mod tests { let (id, expires, serialized, count): (String, Option>, String, i64) = sqlx::query_as("select id, expires, session, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); diff --git a/src/pg.rs b/src/pg.rs index 6cdf4a6..c9d5552 100644 --- a/src/pg.rs +++ b/src/pg.rs @@ -233,7 +233,7 @@ impl PostgresSessionStore { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("DELETE FROM %%TABLE_NAME%% WHERE expires < $1")) .bind(Utc::now()) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -259,7 +259,7 @@ impl PostgresSessionStore { pub async fn count(&self) -> sqlx::Result { let (count,) = sqlx::query_as(&self.substitute_table_name("SELECT COUNT(*) FROM %%TABLE_NAME%%")) - .fetch_one(&mut self.connection().await?) + .fetch_one(&mut *self.connection().await?) .await?; Ok(count) @@ -277,7 +277,7 @@ impl SessionStore for PostgresSessionStore { )) .bind(&id) .bind(Utc::now()) - .fetch_optional(&mut connection) + .fetch_optional(&mut *connection) .await?; Ok(result @@ -302,7 +302,7 @@ impl SessionStore for PostgresSessionStore { .bind(&id) .bind(&string) .bind(&session.expiry()) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(session.into_cookie_value()) @@ -313,7 +313,7 @@ impl SessionStore for PostgresSessionStore { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("DELETE FROM %%TABLE_NAME%% WHERE id = $1")) .bind(&id) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -322,7 +322,7 @@ impl SessionStore for PostgresSessionStore { async fn clear_store(&self) -> Result { let mut connection = self.connection().await?; sqlx::query(&self.substitute_table_name("TRUNCATE %%TABLE_NAME%%")) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -360,7 +360,7 @@ mod tests { let (id, expires, serialized, count): (String, Option>, String, i64) = sqlx::query_as("select id, expires, session, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -397,7 +397,7 @@ mod tests { let (id, count): (String, i64) = sqlx::query_as("select id, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -427,7 +427,7 @@ mod tests { let (id, expires, count): (String, DateTime, i64) = sqlx::query_as( "select id, expires, (select count(*) from async_sessions) from async_sessions", ) - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -449,7 +449,7 @@ mod tests { let (id, expires, serialized, count): (String, Option>, String, i64) = sqlx::query_as("select id, expires, session, (select count(*) from async_sessions) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); diff --git a/src/sqlite.rs b/src/sqlite.rs index 77e973f..28cfca8 100644 --- a/src/sqlite.rs +++ b/src/sqlite.rs @@ -159,7 +159,7 @@ impl SqliteSessionStore { ) "#, )) - .execute(&mut conn) + .execute(&mut *conn) .await?; Ok(()) } @@ -238,7 +238,7 @@ impl SqliteSessionStore { "#, )) .bind(Utc::now().timestamp()) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -263,7 +263,7 @@ impl SqliteSessionStore { pub async fn count(&self) -> sqlx::Result { let (count,) = sqlx::query_as(&self.substitute_table_name("SELECT COUNT(*) FROM %%TABLE_NAME%%")) - .fetch_one(&mut self.connection().await?) + .fetch_one(&mut *self.connection().await?) .await?; Ok(count) @@ -284,7 +284,7 @@ impl SessionStore for SqliteSessionStore { )) .bind(&id) .bind(Utc::now().timestamp()) - .fetch_optional(&mut connection) + .fetch_optional(&mut *connection) .await?; Ok(result @@ -309,7 +309,7 @@ impl SessionStore for SqliteSessionStore { .bind(&id) .bind(&string) .bind(&session.expiry().map(|expiry| expiry.timestamp())) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(session.into_cookie_value()) @@ -324,7 +324,7 @@ impl SessionStore for SqliteSessionStore { "#, )) .bind(&id) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -337,7 +337,7 @@ impl SessionStore for SqliteSessionStore { DELETE FROM %%TABLE_NAME%% "#, )) - .execute(&mut connection) + .execute(&mut *connection) .await?; Ok(()) @@ -370,7 +370,7 @@ mod tests { let (id, expires, serialized, count): (String, Option, String, i64) = sqlx::query_as("select id, expires, session, count(*) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -406,7 +406,7 @@ mod tests { assert_eq!(session.get::("key").unwrap(), "other value"); let (id, count): (String, i64) = sqlx::query_as("select id, count(*) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -435,7 +435,7 @@ mod tests { let (id, expires, count): (String, i64, i64) = sqlx::query_as("select id, expires, count(*) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count); @@ -457,7 +457,7 @@ mod tests { let (id, expires, serialized, count): (String, Option, String, i64) = sqlx::query_as("select id, expires, session, count(*) from async_sessions") - .fetch_one(&mut store.connection().await?) + .fetch_one(&mut *store.connection().await?) .await?; assert_eq!(1, count);