Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e2e7e77
feat: Initialize query history map in app initialization
jorgerojas26 May 26, 2025
c30b11a
feat: Return query string in SQLite GetRecords method
jorgerojas26 May 26, 2025
44745c5
feat: Update GetRecords to return the executed SQL query string
jorgerojas26 May 26, 2025
cbbcf50
refactor: Enhance MSSQL GetRecords with query string and count WHERE
jorgerojas26 May 26, 2025
28da619
feat: Add query to history after successful execution
jorgerojas26 May 26, 2025
0541a06
feat: Capture and store executed query when filtering records.
jorgerojas26 May 26, 2025
adc5b9b
feat: Implement query history modal with filtering and copy.
jorgerojas26 May 26, 2025
25a993a
fix tests
jorgerojas26 May 26, 2025
c6911c1
Merge branch 'main' into query-history
jorgerojas26 Jun 7, 2025
4ceba9f
fix linter
jorgerojas26 Jun 7, 2025
a3ce269
Merge branch 'main' into query-history
jorgerojas26 Jul 28, 2025
95b90a4
fix mssql call to FormatArg
jorgerojas26 Jul 28, 2025
ffdfefc
add yank to query history modal
jorgerojas26 Jul 28, 2025
60eb053
implements saved queries
jorgerojas26 Aug 2, 2025
f22be60
go back to manage tabbed menu keymaps on parent components and other …
jorgerojas26 Aug 18, 2025
9fef7eb
improves behavior of external sql editor
jorgerojas26 Aug 18, 2025
2df1187
creates an env var with the current connection that can be read by th…
jorgerojas26 Aug 18, 2025
e82ce12
fix: table modals not showing
jorgerojas26 Aug 18, 2025
5f5c34c
fix: loading modal causing app to get stuck
jorgerojas26 Aug 18, 2025
0e80aad
fix: prevent double focusing on tab change
jorgerojas26 Sep 6, 2025
ca48351
fix: show save modal on filtering
jorgerojas26 Sep 6, 2025
be3034d
fix: yank query only yanking first line
jorgerojas26 Sep 6, 2025
7fb4fd6
linter fixes
jorgerojas26 Sep 6, 2025
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
17 changes: 15 additions & 2 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,25 @@ type Config struct {
func defaultConfig() *Config {
return &Config{
AppConfig: &models.AppConfig{
DefaultPageSize: 300,
SidebarOverlay: false,
DefaultPageSize: 300,
SidebarOverlay: false,
MaxQueryHistoryPerConnection: 100,
},
}
}

func GetConfigPath() (string, error) {
configDir := os.Getenv("XDG_CONFIG_HOME")
if configDir == "" {
dir, err := os.UserConfigDir()
if err != nil {
return "", err
}
configDir = dir
}
return configDir, nil
}

func DefaultConfigFile() (string, error) {
configDir := os.Getenv("XDG_CONFIG_HOME")
if configDir == "" {
Expand Down
13 changes: 13 additions & 0 deletions app/keymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const (
ConnectionGroup = "connection"
SidebarGroup = "sidebar"
QueryPreviewGroup = "querypreview"
QueryHistoryGroup = "queryhistory"
TabbedMenuGroup = "tabbedmenu"
)

// Define a global KeymapSystem object with default keybinds
Expand All @@ -60,6 +62,7 @@ var Keymaps = KeymapSystem{
Bind{Key: Key{Code: tcell.KeyBackspace2}, Cmd: cmd.SwitchToConnectionsView, Description: "Switch to connections list"},
Bind{Key: Key{Char: '?'}, Cmd: cmd.HelpPopup, Description: "Help"},
Bind{Key: Key{Code: tcell.KeyCtrlP}, Cmd: cmd.SearchGlobal, Description: "Global search"},
Bind{Key: Key{Code: tcell.KeyCtrlUnderscore}, Cmd: cmd.ToggleQueryHistory, Description: "Toggle query history modal"},
},
ConnectionGroup: {
Bind{Key: Key{Char: 'n'}, Cmd: cmd.NewConnection, Description: "Create a new database connection"},
Expand Down Expand Up @@ -148,5 +151,15 @@ var Keymaps = KeymapSystem{
Bind{Key: Key{Char: 'y'}, Cmd: cmd.Copy, Description: "Copy query to clipboard"},
Bind{Key: Key{Char: 'd'}, Cmd: cmd.Delete, Description: "Delete query"},
},
QueryHistoryGroup: {
Bind{Key: Key{Char: 's'}, Cmd: cmd.Save, Description: "Save query"},
Bind{Key: Key{Char: 'd'}, Cmd: cmd.Delete, Description: "Delete query"},
Bind{Key: Key{Char: 'q'}, Cmd: cmd.Quit, Description: "Quit"},
Bind{Key: Key{Char: 'y'}, Cmd: cmd.Copy, Description: "Copy query to clipboard"},
Bind{Key: Key{Char: '/'}, Cmd: cmd.Search, Description: "Search"},
Bind{Key: Key{Code: tcell.KeyCtrlUnderscore}, Cmd: cmd.ToggleQueryHistory, Description: "Toggle query history modal"},
Bind{Key: Key{Char: '['}, Cmd: cmd.TabPrev, Description: "Switch to previous tab"},
Bind{Key: Key{Char: ']'}, Cmd: cmd.TabNext, Description: "Switch to next tab"},
},
},
}
3 changes: 3 additions & 0 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
SwitchToEditorView
SwitchToConnectionsView
HelpPopup
ToggleQueryHistory

// Movement: Basic
MoveUp
Expand Down Expand Up @@ -88,6 +89,8 @@ func (c Command) String() string {
return "SwitchToConnectionsView"
case HelpPopup:
return "HelpPopup"
case ToggleQueryHistory:
return "ToggleQueryHistory"

// Movement: Basic
case MoveUp:
Expand Down
10 changes: 10 additions & 0 deletions components/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
pageNameConfirmation string = "Confirmation"
pageNameConnections string = "Connections"
pageNameDMLPreview string = "DMLPreview"
pageNameErrorModal string = "ErrorModal" // Added new page name

// Results table
pageNameTable string = "Table"
Expand All @@ -34,11 +35,20 @@ const (

// SetValueList
pageNameSetValue string = "SetValue"

// Query History
pageNameQueryHistory string = "QueryHistoryModal"
pageNameSaveQuery string = "SaveQueryModal"
pageNameSavedQueryDelete string = "SavedQueryDeleteModal"
pageNameQueryHistoryDelete string = "QueryHistoryDeleteModal"
)

// Tabs
const (
tabNameEditor string = "Editor"

savedQueryTabReference string = "saved_queries"
queryHistoryTabReference string = "query_history"
)

// Events
Expand Down
12 changes: 12 additions & 0 deletions components/error_modal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package components

import (
"github.com/rivo/tview"
)

func NewErrorModal(message string) *tview.Modal {
modal := tview.NewModal().
SetText(message).
AddButtons([]string{"OK"})
return modal
}
Loading