kurotych / sqlant

Generate PlantUML/Mermaid ER diagram textual description from SQL connection string
MIT License
22 stars 1 forks source link

connection string is unnecessarily limited #16

Closed jayvdb closed 6 months ago

jayvdb commented 6 months ago

If I do

--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,9 +20,9 @@ pub trait ViewGenerator {
 }

 pub fn lookup_parser(connection_string: &str, schema_name: String) -> Box<dyn SqlERDataLoader> {
-    if connection_string.starts_with("postgres") {
+    //if connection_string.starts_with("postgres") {
         return Box::new(PostgreSqlERDLoader::new(connection_string, schema_name));
-    }
+    //}
     panic!("Appropriate parser is not found :(");
 }

I can connect with a connection string like host=/tmp/.tmpFXjbNd user=postgres dbname=butane_test_2d8e5d818d914100a098817c08599faf

This is the connection string style used by https://github.com/Electron100/butane , which I would like to use together with sqlant

jayvdb commented 6 months ago

IMO lookup_parser and PostgreSqlERDLoader::new should return a Result<..> so failure can occur in the Client::connect and be passed back.

kurotych commented 6 months ago

Hi @jayvdb I agree with you we can do this. Would you like to prepare PR?

jayvdb commented 6 months ago

Ok, I can do it.