1- use async_trait:: async_trait;
21use clap:: { Parser , Subcommand } ;
32use color_eyre:: eyre:: OptionExt ;
43use tokio:: sync:: mpsc;
@@ -297,20 +296,34 @@ mod statics {
297296 }
298297}
299298
300- #[ async_trait]
301299trait Database : Sized + Clone + Send {
302- async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > ;
300+ fn overview (
301+ & self ,
302+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: Overview > > + Send ;
303303
304- async fn tables ( & self ) -> color_eyre:: Result < responses:: Tables > ;
304+ fn tables (
305+ & self ,
306+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: Tables > > + Send ;
305307
306- async fn table ( & self , name : String ) -> color_eyre:: Result < responses:: Table > ;
308+ fn table (
309+ & self ,
310+ name : String ,
311+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: Table > > + Send ;
307312
308- async fn table_data ( & self , name : String , page : i32 )
309- -> color_eyre:: Result < responses:: TableData > ;
313+ fn table_data (
314+ & self ,
315+ name : String ,
316+ page : i32 ,
317+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: TableData > > + Send ;
310318
311- async fn tables_with_columns ( & self ) -> color_eyre:: Result < responses:: TablesWithColumns > ;
319+ fn tables_with_columns (
320+ & self ,
321+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: TablesWithColumns > > + Send ;
312322
313- async fn query ( & self , query : String ) -> color_eyre:: Result < responses:: Query > ;
323+ fn query (
324+ & self ,
325+ query : String ,
326+ ) -> impl std:: future:: Future < Output = color_eyre:: Result < responses:: Query > > + Send ;
314327}
315328
316329#[ derive( Clone ) ]
@@ -324,7 +337,6 @@ enum AllDbs {
324337 MsSql ( mssql:: Db ) ,
325338}
326339
327- #[ async_trait]
328340impl Database for AllDbs {
329341 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
330342 match self {
@@ -404,7 +416,6 @@ impl Database for AllDbs {
404416}
405417
406418mod sqlite {
407- use async_trait:: async_trait;
408419 use color_eyre:: eyre:: OptionExt ;
409420 use std:: { collections:: HashMap , path:: Path , sync:: Arc , time:: Duration } ;
410421 use tokio_rusqlite:: { Connection , OpenFlags } ;
@@ -454,7 +465,6 @@ mod sqlite {
454465 }
455466 }
456467
457- #[ async_trait]
458468 impl Database for Db {
459469 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
460470 let file_name = Path :: new ( & self . path )
@@ -816,7 +826,6 @@ mod sqlite {
816826mod libsql {
817827 use std:: { collections:: HashMap , sync:: Arc , time:: Duration } ;
818828
819- use async_trait:: async_trait;
820829 use color_eyre:: eyre:: OptionExt ;
821830 use futures:: { StreamExt , TryStreamExt } ;
822831 use libsql:: Builder ;
@@ -901,7 +910,6 @@ mod libsql {
901910 }
902911 }
903912
904- #[ async_trait]
905913 impl Database for Db {
906914 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
907915 let file_name = self . name . to_owned ( ) ;
@@ -1380,7 +1388,6 @@ mod libsql {
13801388mod postgres {
13811389 use std:: { sync:: Arc , time:: Duration } ;
13821390
1383- use async_trait:: async_trait;
13841391 use tokio_postgres:: { Client , NoTls } ;
13851392
13861393 use crate :: {
@@ -1440,7 +1447,6 @@ mod postgres {
14401447 }
14411448 }
14421449
1443- #[ async_trait]
14441450 impl Database for Db {
14451451 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
14461452 let schema = & self . schema ;
@@ -1906,7 +1912,6 @@ mod postgres {
19061912mod mysql {
19071913 use std:: time:: Duration ;
19081914
1909- use async_trait:: async_trait;
19101915 use color_eyre:: eyre:: OptionExt ;
19111916 use mysql_async:: { prelude:: * , Pool } ;
19121917
@@ -1951,7 +1956,6 @@ mod mysql {
19511956 }
19521957 }
19531958
1954- #[ async_trait]
19551959 impl Database for Db {
19561960 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
19571961 let mut conn = self . pool . get_conn ( ) . await ?;
@@ -2343,7 +2347,6 @@ mod mysql {
23432347}
23442348
23452349mod duckdb {
2346- use async_trait:: async_trait;
23472350 use color_eyre:: eyre;
23482351 use color_eyre:: eyre:: OptionExt ;
23492352 use duckdb:: { Config , Connection } ;
@@ -2405,7 +2408,6 @@ mod duckdb {
24052408 }
24062409 }
24072410
2408- #[ async_trait]
24092411 impl Database for Db {
24102412 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
24112413 let file_name = Path :: new ( & self . path )
@@ -2754,7 +2756,6 @@ mod duckdb {
27542756}
27552757
27562758mod clickhouse {
2757- use async_trait:: async_trait;
27582759 use clickhouse:: Client ;
27592760 use color_eyre:: eyre:: OptionExt ;
27602761 use std:: time:: Duration ;
@@ -2815,7 +2816,6 @@ mod clickhouse {
28152816 }
28162817 }
28172818
2818- #[ async_trait]
28192819 impl Database for Db {
28202820 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
28212821 let file_name = self . database . to_owned ( ) ;
@@ -3152,7 +3152,6 @@ mod clickhouse {
31523152mod mssql {
31533153 use std:: { sync:: Arc , time:: Duration } ;
31543154
3155- use async_trait:: async_trait;
31563155 use color_eyre:: eyre:: OptionExt ;
31573156 use futures:: { StreamExt , TryStreamExt } ;
31583157 use tiberius:: { Client , Config } ;
@@ -3208,7 +3207,6 @@ mod mssql {
32083207 }
32093208 }
32103209
3211- #[ async_trait]
32123210 impl Database for Db {
32133211 async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
32143212 let mut client = self . client . lock ( ) . await ;
0 commit comments