From 5cd3432d4a19acaf51324a65a94c8c1940505c46 Mon Sep 17 00:00:00 2001 From: giuseppe-g-gelardi Date: Sun, 22 Dec 2024 19:51:40 -0500 Subject: [PATCH] start impl fk constraits in the query chain -- dont like it on the table --- src/query_operations/mod.rs | 10 ++++++++++ src/query_operations/query.rs | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/query_operations/mod.rs b/src/query_operations/mod.rs index 4074cc9..ac00e06 100644 --- a/src/query_operations/mod.rs +++ b/src/query_operations/mod.rs @@ -22,3 +22,13 @@ pub struct Query { pub update_data: Option, pub row_data: Option, } + + +#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] +pub struct ForeignKeyConstraint { + pub table_name: String, + pub column_name: String, + pub foreign_table_name: String, + pub foreign_column_name: String, +} + diff --git a/src/query_operations/query.rs b/src/query_operations/query.rs index 4face82..3fba06c 100644 --- a/src/query_operations/query.rs +++ b/src/query_operations/query.rs @@ -69,10 +69,10 @@ impl Query { let mut db = Database::load_from_file(&self.db_file_name) .await .map_err(DatabaseError::LoadError)?; - self.handle_execute_add_sync(&mut db).await // Shared logic + self.handle_execute_add(&mut db).await // Shared logic } - async fn handle_execute_add_sync(&self, db: &mut Database) -> Result<(), DatabaseError> { + async fn handle_execute_add(&self, db: &mut Database) -> Result<(), DatabaseError> { let table_name = self .table_name .clone()