From 3428a637ce420baef9aa9f9803e71bd587867005 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Wed, 10 Apr 2024 00:16:55 +0200 Subject: Closes #24. Changed postgres to json directory storage --- src/db.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/db.rs (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs deleted file mode 100644 index a2b2009..0000000 --- a/src/db.rs +++ /dev/null @@ -1,37 +0,0 @@ -use serde::Serialize; -use sqlx::{PgPool, postgres::PgPoolOptions, types::{ipnetwork::IpNetwork, mac_address::MacAddress}}; -use tracing::{debug, info}; -use utoipa::ToSchema; - -#[derive(Serialize, Debug)] -pub struct Device { - pub id: String, - pub mac: MacAddress, - pub broadcast_addr: String, - pub ip: IpNetwork, - pub times: Option> -} - -#[derive(ToSchema)] -#[schema(as = Device)] -pub struct DeviceSchema { - pub id: String, - pub mac: String, - pub broadcast_addr: String, - pub ip: String, - pub times: Option> -} - -pub async fn init_db_pool(db_url: &str) -> PgPool { - debug!("attempt to connect dbPool to '{}'", db_url); - - let pool = PgPoolOptions::new() - .max_connections(5) - .connect(db_url) - .await - .unwrap(); - - info!("dbPool successfully connected to '{}'", db_url); - - pool -} -- cgit v1.2.3