- fix: issue compiling due to sqlx::query! throwing error on windows
This commit is contained in:
@@ -9,7 +9,7 @@ consul = []
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.41.1", features = ["full"] }
|
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"
|
tonic = "0.12.3"
|
||||||
chrono = { version = "0.4.39", features = ["serde"] }
|
chrono = { version = "0.4.39", features = ["serde"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|||||||
@@ -81,20 +81,20 @@ impl UserRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_user(&self, username: &str, email: &str, hashed_password: &str) -> Result<i32, sqlx::Error> {
|
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#"
|
r#"
|
||||||
INSERT INTO users (username, email, hashed_password)
|
INSERT INTO users (username, email, hashed_password)
|
||||||
VALUES ($1, $2, $3)
|
VALUES ($1, $2, $3)
|
||||||
RETURNING id
|
RETURNING id
|
||||||
"#,
|
"#,
|
||||||
username,
|
|
||||||
email,
|
|
||||||
hashed_password
|
|
||||||
)
|
)
|
||||||
|
.bind(username)
|
||||||
|
.bind(email)
|
||||||
|
.bind(hashed_password)
|
||||||
.fetch_one(&self.pool)
|
.fetch_one(&self.pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(result.id)
|
Ok(row.get(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_user_email(&self, user_id: i32, new_email: &str) -> Result<(), sqlx::Error> {
|
pub async fn update_user_email(&self, user_id: i32, new_email: &str) -> Result<(), sqlx::Error> {
|
||||||
|
|||||||
Reference in New Issue
Block a user