From 76467a6fed7ca0465961522d07dbbe960aeb4156 Mon Sep 17 00:00:00 2001 From: Alex Groleau Date: Fri, 27 Mar 2026 19:19:27 -0400 Subject: [PATCH] log cleanup --- agreego.sql | 0 src/database/executors/mock.rs | 10 +++++----- src/merger/mod.rs | 6 ------ src/queryer/compiler.rs | 26 +++++++++++++++++++------- 4 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 agreego.sql diff --git a/agreego.sql b/agreego.sql new file mode 100644 index 0000000..e69de29 diff --git a/src/database/executors/mock.rs b/src/database/executors/mock.rs index 6086093..508a6d8 100644 --- a/src/database/executors/mock.rs +++ b/src/database/executors/mock.rs @@ -45,7 +45,7 @@ impl MockExecutor { #[cfg(test)] impl DatabaseExecutor for MockExecutor { fn query(&self, sql: &str, _args: Option<&[Value]>) -> Result { - println!("DEBUG SQL QUERY: {}", sql); + println!("JSPG_SQL: {}", sql); MOCK_STATE.with(|state| { let mut s = state.borrow_mut(); s.captured_queries.push(sql.to_string()); @@ -66,7 +66,7 @@ impl DatabaseExecutor for MockExecutor { } fn execute(&self, sql: &str, _args: Option<&[Value]>) -> Result<(), String> { - println!("DEBUG SQL EXECUTE: {}", sql); + println!("JSPG_SQL: {}", sql); MOCK_STATE.with(|state| { let mut s = state.borrow_mut(); s.captured_queries.push(sql.to_string()); @@ -170,7 +170,7 @@ fn parse_and_match_mocks(sql: &str, mocks: &[Value]) -> Option> { .unwrap_or("") .trim_matches('"'); let right = part[eq_idx + 1..].trim().trim_matches('\''); - + let mock_val_str = match mock_obj.get(left) { Some(Value::String(s)) => s.clone(), Some(Value::Number(n)) => n.to_string(), @@ -189,12 +189,12 @@ fn parse_and_match_mocks(sql: &str, mocks: &[Value]) -> Option> { .last() .unwrap_or("") .trim_matches('"'); - + let mock_val_str = match mock_obj.get(left) { Some(Value::Null) => "null".to_string(), _ => "".to_string(), }; - + if mock_val_str != "null" { branch_matches = false; break; diff --git a/src/merger/mod.rs b/src/merger/mod.rs index 6ab0f09..f53d5f6 100644 --- a/src/merger/mod.rs +++ b/src/merger/mod.rs @@ -259,13 +259,7 @@ impl Merger { }; if let Some(compiled_edges) = schema.obj.compiled_edges.get() { - println!( - "Compiled Edges keys for relation {}: {:?}", - relation_name, - compiled_edges.keys().collect::>() - ); if let Some(edge) = compiled_edges.get(&relation_name) { - println!("FOUND EDGE {} -> {:?}", relation_name, edge.constraint); if let Some(relation) = self.db.relations.get(&edge.constraint) { let parent_is_source = edge.forward; diff --git a/src/queryer/compiler.rs b/src/queryer/compiler.rs index 351d546..c826f01 100644 --- a/src/queryer/compiler.rs +++ b/src/queryer/compiler.rs @@ -67,7 +67,10 @@ impl<'a> Compiler<'a> { if let Some(items) = &node.schema.obj.items { let mut resolved_type = None; if let Some(family_target) = items.obj.family.as_ref() { - let base_type_name = family_target.split('.').next_back().unwrap_or(family_target); + let base_type_name = family_target + .split('.') + .next_back() + .unwrap_or(family_target); resolved_type = self.db.types.get(base_type_name); } else if let Some(base_type_name) = items.obj.identifier() { resolved_type = self.db.types.get(&base_type_name); @@ -89,7 +92,10 @@ impl<'a> Compiler<'a> { } // 3. Fallback for root execution of standalone non-entity arrays - Err("Cannot compile a root array without a valid entity reference or table mapped via `items`.".to_string()) + Err( + "Cannot compile a root array without a valid entity reference or table mapped via `items`." + .to_string(), + ) } fn compile_reference(&mut self, node: Node<'a>) -> Result<(String, String), String> { @@ -452,7 +458,6 @@ impl<'a> Compiler<'a> { }, }; - let (val_sql, val_type) = self.compile_node(child_node)?; if val_type != "abort" { @@ -515,7 +520,13 @@ impl<'a> Compiler<'a> { // Determine if the property schema resolves to a physical Database Entity let mut bound_type_name = None; if let Some(family_target) = prop_schema.obj.family.as_ref() { - bound_type_name = Some(family_target.split('.').next_back().unwrap_or(family_target).to_string()); + bound_type_name = Some( + family_target + .split('.') + .next_back() + .unwrap_or(family_target) + .to_string(), + ); } else if let Some(lookup_key) = prop_schema.obj.identifier() { bound_type_name = Some(lookup_key); } @@ -536,7 +547,10 @@ impl<'a> Compiler<'a> { } if let Some(col) = poly_col { - if let Some(alias) = type_aliases.get(table_to_alias).or_else(|| type_aliases.get(&node.parent_alias)) { + if let Some(alias) = type_aliases + .get(table_to_alias) + .or_else(|| type_aliases.get(&node.parent_alias)) + { where_clauses.push(format!("{}.{} = '{}'", alias, col, type_name)); } } @@ -710,8 +724,6 @@ impl<'a> Compiler<'a> { ) -> Result<(), String> { if let Some(prop_ref) = &node.property_name { let prop = prop_ref.as_str(); - println!("DEBUG: Eval prop: {}", prop); - let mut parent_relation_alias = node.parent_alias.clone(); let mut child_relation_alias = base_alias.to_string();