- fix: issue compiling due to sqlx::query! throwing error on windows

This commit is contained in:
2024-12-18 12:44:28 -05:00
parent a444fa4558
commit 9e530c2d55
2 changed files with 6 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ consul = []
[dependencies]
tokio = { version = "1.41.1", features = ["full"] }
sqlx = { version = "0.7", features = ["postgres", "runtime-tokio-native-tls", "chrono"] }
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio-native-tls", "chrono"] }
tonic = "0.12.3"
chrono = { version = "0.4.39", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }

View File

@@ -81,20 +81,20 @@ impl UserRepository {
}
pub async fn create_user(&self, username: &str, email: &str, hashed_password: &str) -> Result<i32, sqlx::Error> {
let result = sqlx::query!(
let row = sqlx::query(
r#"
INSERT INTO users (username, email, hashed_password)
VALUES ($1, $2, $3)
RETURNING id
"#,
username,
email,
hashed_password
)
.bind(username)
.bind(email)
.bind(hashed_password)
.fetch_one(&self.pool)
.await?;
Ok(result.id)
Ok(row.get(0))
}
pub async fn update_user_email(&self, user_id: i32, new_email: &str) -> Result<(), sqlx::Error> {