Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Nov 10, 2024
2 parents 9469021 + 7972cf4 commit eb11b63
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/tile_save_and_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ pub async fn delete_tile(
Ok(())
}

pub async fn delete_in_bbox(conn: &mut bb8::PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>>,
category: TileCategory,
z: u8,
min_x: i32,
max_x: i32,
min_y: i32,
max_y: i32
) -> Result<(), anyhow::Error> {
let category_i16 = tile_enum_to_i16(category);

let _ = diesel::delete(
crate::schema::gtfs::tile_storage::dsl::tile_storage
.filter(crate::schema::gtfs::tile_storage::dsl::category.eq(category_i16))
.filter(crate::schema::gtfs::tile_storage::dsl::x.ge(min_x))
.filter(crate::schema::gtfs::tile_storage::dsl::x.le(max_x))
.filter(crate::schema::gtfs::tile_storage::dsl::y.ge(min_y))
.filter(crate::schema::gtfs::tile_storage::dsl::y.le(max_y))
);

Ok(())
}

pub async fn get_tile(
conn: &mut bb8::PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>>,
category: TileCategory,
Expand Down

0 comments on commit eb11b63

Please sign in to comment.