Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databases tree view #245

Merged
merged 6 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Available Commands:
Flags:
--cfg-name string Database config name section
--config Get the connection data from a config file (default locations are: current directory, $HOME/.dblab.yaml or $XDG_CONFIG_HOME/.dblab.yaml)
--db string Database name
--db string Database name (optional)
--driver string Database driver
--encrypt string [strict|disable|false|true] data sent between client and server is encrypted or not
-h, --help help for dblab
Expand Down Expand Up @@ -264,8 +264,14 @@ Now, there's a menu to navigate between hidden views by just clicking on the des
<img src="screenshots/constraints-view.png" />
<img src="screenshots/indexes-view.png" />

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.
Just hit the `BACK` and `NEXT` buttons to go back and forth.
~~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.
Just hit the `BACK` and `NEXT` buttons to go back and forth.~~

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`.

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.

<img src="screenshots/tree-view.png" />

### Key Bindings
| Key | Description |
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func init() {
rootCmd.Flags().StringVarP(&port, "port", "", "", "Server port")
rootCmd.Flags().StringVarP(&user, "user", "", "", "Database user")
rootCmd.Flags().StringVarP(&pass, "pass", "", "", "Password for user")
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name")
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name (optional)")
rootCmd.Flags().StringVarP(&schema, "schema", "", "", "Database schema (postgres only)")
rootCmd.Flags().StringVarP(&ssl, "ssl", "", "", "SSL mode")
rootCmd.Flags().
Expand Down
Loading