Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump sqlx to 0.7 #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
20 changes: 10 additions & 10 deletions src/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand All @@ -261,7 +261,7 @@ impl MySqlSessionStore {
pub async fn count(&self) -> sqlx::Result<i64> {
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)
Expand All @@ -279,7 +279,7 @@ impl SessionStore for MySqlSessionStore {
))
.bind(&id)
.bind(Utc::now())
.fetch_optional(&mut connection)
.fetch_optional(&mut *connection)
.await?;

Ok(result
Expand All @@ -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())
Expand All @@ -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(())
Expand All @@ -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(())
Expand Down Expand Up @@ -362,7 +362,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<DateTime<Utc>>, 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -429,7 +429,7 @@ mod tests {
let (id, expires, count): (String, DateTime<Utc>, 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);
Expand All @@ -451,7 +451,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<DateTime<Utc>>, 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);
Expand Down
20 changes: 10 additions & 10 deletions src/pg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand All @@ -259,7 +259,7 @@ impl PostgresSessionStore {
pub async fn count(&self) -> sqlx::Result<i64> {
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)
Expand All @@ -277,7 +277,7 @@ impl SessionStore for PostgresSessionStore {
))
.bind(&id)
.bind(Utc::now())
.fetch_optional(&mut connection)
.fetch_optional(&mut *connection)
.await?;

Ok(result
Expand All @@ -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())
Expand All @@ -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(())
Expand All @@ -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(())
Expand Down Expand Up @@ -360,7 +360,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<DateTime<Utc>>, 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -427,7 +427,7 @@ mod tests {
let (id, expires, count): (String, DateTime<Utc>, 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);
Expand All @@ -449,7 +449,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<DateTime<Utc>>, 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);
Expand Down
22 changes: 11 additions & 11 deletions src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl SqliteSessionStore {
)
"#,
))
.execute(&mut conn)
.execute(&mut *conn)
.await?;
Ok(())
}
Expand Down Expand Up @@ -238,7 +238,7 @@ impl SqliteSessionStore {
"#,
))
.bind(Utc::now().timestamp())
.execute(&mut connection)
.execute(&mut *connection)
.await?;

Ok(())
Expand All @@ -263,7 +263,7 @@ impl SqliteSessionStore {
pub async fn count(&self) -> sqlx::Result<i32> {
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)
Expand All @@ -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
Expand All @@ -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())
Expand All @@ -324,7 +324,7 @@ impl SessionStore for SqliteSessionStore {
"#,
))
.bind(&id)
.execute(&mut connection)
.execute(&mut *connection)
.await?;

Ok(())
Expand All @@ -337,7 +337,7 @@ impl SessionStore for SqliteSessionStore {
DELETE FROM %%TABLE_NAME%%
"#,
))
.execute(&mut connection)
.execute(&mut *connection)
.await?;

Ok(())
Expand Down Expand Up @@ -370,7 +370,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<i64>, 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);
Expand Down Expand Up @@ -406,7 +406,7 @@ mod tests {
assert_eq!(session.get::<String>("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);
Expand Down Expand Up @@ -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);
Expand All @@ -457,7 +457,7 @@ mod tests {

let (id, expires, serialized, count): (String, Option<i64>, 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);
Expand Down