From 28428a0d5415743b26b046484ba15a4659c3cf32 Mon Sep 17 00:00:00 2001 From: Ben King <9087625+benfdking@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:18:01 +0100 Subject: [PATCH] refactor: order of impl matches trait --- rust/quary-databases/src/databases_bigquery.rs | 8 ++++---- rust/quary-databases/src/databases_duckdb.rs | 8 ++++---- rust/quary-databases/src/databases_postgres.rs | 8 ++++---- rust/quary-databases/src/databases_redshift.rs | 14 +++++++------- rust/quary-databases/src/databases_snowflake.rs | 8 ++++---- rust/quary-databases/src/databases_sqlite.rs | 8 ++++---- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/rust/quary-databases/src/databases_bigquery.rs b/rust/quary-databases/src/databases_bigquery.rs index d16aef44..e3013fab 100644 --- a/rust/quary-databases/src/databases_bigquery.rs +++ b/rust/quary-databases/src/databases_bigquery.rs @@ -280,14 +280,14 @@ impl DatabaseConnection for BigQuery { }) } - async fn table_exists(&self, _path: &str) -> Result, String> { - Ok(None) // not implemented - } - fn query_generator(&self) -> Box { Box::new(DatabaseQueryGeneratorBigQuery::new( self.project_id.to_string(), self.dataset_id.to_string(), )) } + + async fn table_exists(&self, _path: &str) -> Result, String> { + Ok(None) // not implemented + } } diff --git a/rust/quary-databases/src/databases_duckdb.rs b/rust/quary-databases/src/databases_duckdb.rs index 6abdd1ff..9626d174 100644 --- a/rust/quary-databases/src/databases_duckdb.rs +++ b/rust/quary-databases/src/databases_duckdb.rs @@ -209,13 +209,13 @@ impl DatabaseConnection for DuckDB { }) } - async fn table_exists(&self, _path: &str) -> Result, String> { - Ok(None) // not implemented - } - fn query_generator(&self) -> Box { Box::new(DatabaseQueryGeneratorDuckDB::new(self.schema.clone(), None)) } + + async fn table_exists(&self, _path: &str) -> Result, String> { + Ok(None) // not implemented + } } fn convert_array_to_vec_string(array: &[Arc]) -> Result>, String> { diff --git a/rust/quary-databases/src/databases_postgres.rs b/rust/quary-databases/src/databases_postgres.rs index ccf4f03d..dc7d7c79 100644 --- a/rust/quary-databases/src/databases_postgres.rs +++ b/rust/quary-databases/src/databases_postgres.rs @@ -324,16 +324,16 @@ impl DatabaseConnection for Postgres { }) } - async fn table_exists(&self, _path: &str) -> Result, String> { - Ok(None) // not implemented - } - fn query_generator(&self) -> Box { Box::new(DatabaseQueryGeneratorPostgres::new( self.schema.clone(), None, )) } + + async fn table_exists(&self, _path: &str) -> Result, String> { + Ok(None) // not implemented + } } #[cfg(test)] diff --git a/rust/quary-databases/src/databases_redshift.rs b/rust/quary-databases/src/databases_redshift.rs index 12688a64..ed4561ea 100644 --- a/rust/quary-databases/src/databases_redshift.rs +++ b/rust/quary-databases/src/databases_redshift.rs @@ -86,6 +86,13 @@ impl DatabaseConnection for Redshift { self.postgres.query(query).await } + fn query_generator(&self) -> Box { + Box::new(DatabaseQueryGeneratorRedshift::new( + self.schema.clone(), + None, + )) + } + async fn table_exists(&self, path: &str) -> Result, String> { let parts: Vec<&str> = path.split('.').collect(); let (schema, table) = match parts.len() { @@ -100,13 +107,6 @@ impl DatabaseConnection for Redshift { .await?; Ok(Some(result.len() > 0)) } - - fn query_generator(&self) -> Box { - Box::new(DatabaseQueryGeneratorRedshift::new( - self.schema.clone(), - None, - )) - } } #[cfg(test)] diff --git a/rust/quary-databases/src/databases_snowflake.rs b/rust/quary-databases/src/databases_snowflake.rs index f9b4fcda..9224a9c2 100644 --- a/rust/quary-databases/src/databases_snowflake.rs +++ b/rust/quary-databases/src/databases_snowflake.rs @@ -284,16 +284,16 @@ impl DatabaseConnection for Snowflake { }; } - async fn table_exists(&self, _path: &str) -> Result, String> { - Ok(None) // not implemented - } - fn query_generator(&self) -> Box { Box::new(DatabaseQueryGeneratorSnowflake::new( self.database.to_string(), self.schema.to_string(), )) } + + async fn table_exists(&self, _path: &str) -> Result, String> { + Ok(None) // not implemented + } } pub fn convert_array_to_vec_string( diff --git a/rust/quary-databases/src/databases_sqlite.rs b/rust/quary-databases/src/databases_sqlite.rs index cdc699ab..7e3e4cbe 100644 --- a/rust/quary-databases/src/databases_sqlite.rs +++ b/rust/quary-databases/src/databases_sqlite.rs @@ -149,13 +149,13 @@ impl DatabaseConnection for Sqlite { }) } - async fn table_exists(&self, _path: &str) -> Result, String> { - Ok(None) // not implemented - } - fn query_generator(&self) -> Box { Box::new(DatabaseQueryGeneratorSqlite {}) } + + async fn table_exists(&self, _path: &str) -> Result, String> { + Ok(None) // not implemented + } } #[cfg(test)]