1
- use async_trait:: async_trait;
2
1
use clap:: { Parser , Subcommand } ;
3
2
use color_eyre:: eyre:: OptionExt ;
4
3
use tokio:: sync:: mpsc;
@@ -297,20 +296,34 @@ mod statics {
297
296
}
298
297
}
299
298
300
- #[ async_trait]
301
299
trait 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 ;
303
303
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 ;
305
307
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 ;
307
312
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 ;
310
318
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 ;
312
322
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 ;
314
327
}
315
328
316
329
#[ derive( Clone ) ]
@@ -324,7 +337,6 @@ enum AllDbs {
324
337
MsSql ( mssql:: Db ) ,
325
338
}
326
339
327
- #[ async_trait]
328
340
impl Database for AllDbs {
329
341
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
330
342
match self {
@@ -404,7 +416,6 @@ impl Database for AllDbs {
404
416
}
405
417
406
418
mod sqlite {
407
- use async_trait:: async_trait;
408
419
use color_eyre:: eyre:: OptionExt ;
409
420
use std:: { collections:: HashMap , path:: Path , sync:: Arc , time:: Duration } ;
410
421
use tokio_rusqlite:: { Connection , OpenFlags } ;
@@ -454,7 +465,6 @@ mod sqlite {
454
465
}
455
466
}
456
467
457
- #[ async_trait]
458
468
impl Database for Db {
459
469
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
460
470
let file_name = Path :: new ( & self . path )
@@ -816,7 +826,6 @@ mod sqlite {
816
826
mod libsql {
817
827
use std:: { collections:: HashMap , sync:: Arc , time:: Duration } ;
818
828
819
- use async_trait:: async_trait;
820
829
use color_eyre:: eyre:: OptionExt ;
821
830
use futures:: { StreamExt , TryStreamExt } ;
822
831
use libsql:: Builder ;
@@ -901,7 +910,6 @@ mod libsql {
901
910
}
902
911
}
903
912
904
- #[ async_trait]
905
913
impl Database for Db {
906
914
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
907
915
let file_name = self . name . to_owned ( ) ;
@@ -1380,7 +1388,6 @@ mod libsql {
1380
1388
mod postgres {
1381
1389
use std:: { sync:: Arc , time:: Duration } ;
1382
1390
1383
- use async_trait:: async_trait;
1384
1391
use tokio_postgres:: { Client , NoTls } ;
1385
1392
1386
1393
use crate :: {
@@ -1440,7 +1447,6 @@ mod postgres {
1440
1447
}
1441
1448
}
1442
1449
1443
- #[ async_trait]
1444
1450
impl Database for Db {
1445
1451
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
1446
1452
let schema = & self . schema ;
@@ -1906,7 +1912,6 @@ mod postgres {
1906
1912
mod mysql {
1907
1913
use std:: time:: Duration ;
1908
1914
1909
- use async_trait:: async_trait;
1910
1915
use color_eyre:: eyre:: OptionExt ;
1911
1916
use mysql_async:: { prelude:: * , Pool } ;
1912
1917
@@ -1951,7 +1956,6 @@ mod mysql {
1951
1956
}
1952
1957
}
1953
1958
1954
- #[ async_trait]
1955
1959
impl Database for Db {
1956
1960
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
1957
1961
let mut conn = self . pool . get_conn ( ) . await ?;
@@ -2343,7 +2347,6 @@ mod mysql {
2343
2347
}
2344
2348
2345
2349
mod duckdb {
2346
- use async_trait:: async_trait;
2347
2350
use color_eyre:: eyre;
2348
2351
use color_eyre:: eyre:: OptionExt ;
2349
2352
use duckdb:: { Config , Connection } ;
@@ -2405,7 +2408,6 @@ mod duckdb {
2405
2408
}
2406
2409
}
2407
2410
2408
- #[ async_trait]
2409
2411
impl Database for Db {
2410
2412
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
2411
2413
let file_name = Path :: new ( & self . path )
@@ -2754,7 +2756,6 @@ mod duckdb {
2754
2756
}
2755
2757
2756
2758
mod clickhouse {
2757
- use async_trait:: async_trait;
2758
2759
use clickhouse:: Client ;
2759
2760
use color_eyre:: eyre:: OptionExt ;
2760
2761
use std:: time:: Duration ;
@@ -2815,7 +2816,6 @@ mod clickhouse {
2815
2816
}
2816
2817
}
2817
2818
2818
- #[ async_trait]
2819
2819
impl Database for Db {
2820
2820
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
2821
2821
let file_name = self . database . to_owned ( ) ;
@@ -3152,7 +3152,6 @@ mod clickhouse {
3152
3152
mod mssql {
3153
3153
use std:: { sync:: Arc , time:: Duration } ;
3154
3154
3155
- use async_trait:: async_trait;
3156
3155
use color_eyre:: eyre:: OptionExt ;
3157
3156
use futures:: { StreamExt , TryStreamExt } ;
3158
3157
use tiberius:: { Client , Config } ;
@@ -3208,7 +3207,6 @@ mod mssql {
3208
3207
}
3209
3208
}
3210
3209
3211
- #[ async_trait]
3212
3210
impl Database for Db {
3213
3211
async fn overview ( & self ) -> color_eyre:: Result < responses:: Overview > {
3214
3212
let mut client = self . client . lock ( ) . await ;
0 commit comments