Skip to content

Commit a0a6fdc

Browse files
authored
feat: databases tree view (#245)
* feat(client): adapt the client to handler database-less connections * feat(connection): add the change to make the database param non-mandatory * feat(client): update the database implementations to be complaint with databaseQuerier interface * feat(tui): refactor the tui to handler connection without the database * fix(pkg): address ccoVeille comments Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com> * docs(readme): add instructions on how to use new tree view
1 parent 459cc1b commit a0a6fdc

File tree

15 files changed

+434
-318
lines changed

15 files changed

+434
-318
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Available Commands:
9393
Flags:
9494
--cfg-name string Database config name section
9595
--config Get the connection data from a config file (default locations are: current directory, $HOME/.dblab.yaml or $XDG_CONFIG_HOME/.dblab.yaml)
96-
--db string Database name
96+
--db string Database name (optional)
9797
--driver string Database driver
9898
--encrypt string [strict|disable|false|true] data sent between client and server is encrypted or not
9999
-h, --help help for dblab
@@ -264,8 +264,14 @@ Now, there's a menu to navigate between hidden views by just clicking on the des
264264
<img src="screenshots/constraints-view.png" />
265265
<img src="screenshots/indexes-view.png" />
266266

267-
As you may have noticed, navigation has already been added, so every time you query the content of a listed table, the result set is going to be paginated. This allows to the user dealing with large tables, optimizing resources.
268-
Just hit the `BACK` and `NEXT` buttons to go back and forth.
267+
~~As you may have noticed, navigation has already been added, so every time you query the content of a listed table, the result set is going to be paginated. This allows to the user dealing with large tables, optimizing resources.
268+
Just hit the `BACK` and `NEXT` buttons to go back and forth.~~
269+
270+
The navigation buttons were removed since they are too slow to really navigate the content of a table. The user is better off typing a `SELECT` statement with proper `OFFSET` and `LIMIT`.
271+
272+
The `--db` flag is now optional (except for Oracle), meaning that the user will be able to see the list of databases they have access to. The regular list of tables will be replaced with a tree structure showing a list of databases and their respective list of tables, branching off each database. Due to the nature of the vast majority of DBMSs that don't allow cross-database queries, dblab has to open an independent connection for each database. The side effect of this decision, is that the user has to press `Enter` on the specific database of interest. An indicator showing the current active database will appear at the bottom-right of the screen. To change the focus, just hit enter on another database. Once a database is selected, the usual behavior of inspecting tables remains the same.
273+
274+
<img src="screenshots/tree-view.png" />
269275

270276
### Key Bindings
271277
| Key | Description |

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func init() {
134134
rootCmd.Flags().StringVarP(&port, "port", "", "", "Server port")
135135
rootCmd.Flags().StringVarP(&user, "user", "", "", "Database user")
136136
rootCmd.Flags().StringVarP(&pass, "pass", "", "", "Password for user")
137-
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name")
137+
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name (optional)")
138138
rootCmd.Flags().StringVarP(&schema, "schema", "", "", "Database schema (postgres only)")
139139
rootCmd.Flags().StringVarP(&ssl, "ssl", "", "", "SSL mode")
140140
rootCmd.Flags().

0 commit comments

Comments
 (0)