Skip to content

Commit

Permalink
Disable static database checks in library
Browse files Browse the repository at this point in the history
This allows the library to be used in projects with their own static
SQLx checks. This is a workaround for
launchbadge/sqlx#121
  • Loading branch information
fenhl committed Jan 10, 2025
1 parent 09e5948 commit 8c98ecc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crate/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
publish = false

[dependencies]
chrono = "0.4.38"
chrono = { version = "0.4.38", features = ["serde"] }
chrono-tz = { version = "0.9", features = ["serde"] }
lazy-regex = "3.2.0"
rocket = { features = ["secrets"], version = "0.5" }
Expand Down
4 changes: 2 additions & 2 deletions crate/lib/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Location {

impl Location {
async fn load(db_pool: impl PgExecutor<'_>, loc_id: &str) -> sqlx::Result<Option<Self>> {
Ok(sqlx::query_scalar!(r#"SELECT value AS "value: Json<Self>" FROM json_locations WHERE id = $1"#, loc_id).fetch_optional(db_pool).await?.map(|Json(value)| value))
Ok(sqlx::query_scalar(r#"SELECT value AS "value: Json<Self>" FROM json_locations WHERE id = $1"#).bind(loc_id).fetch_optional(db_pool).await?.map(|Json(value)| value))
}
}

Expand Down Expand Up @@ -60,7 +60,7 @@ pub struct Event {

impl Event {
pub async fn load(db_pool: impl PgExecutor<'_>, event_id: &str) -> sqlx::Result<Option<Self>> {
Ok(sqlx::query_scalar!(r#"SELECT value AS "value: Json<Self>" FROM json_events WHERE id = $1"#, event_id).fetch_optional(db_pool).await?.map(|Json(value)| value))
Ok(sqlx::query_scalar(r#"SELECT value AS "value: Json<Self>" FROM json_events WHERE id = $1"#).bind(event_id).fetch_optional(db_pool).await?.map(|Json(value)| value))
}

async fn location_info(&self, db_pool: impl PgExecutor<'_>) -> Result<LocationInfo, Error> {
Expand Down

0 comments on commit 8c98ecc

Please sign in to comment.