Documentation
¶
Index ¶
Constants ¶
const ( ActionFocusTables = "focus_tables" ActionFocusQuery = "focus_query" ActionFocusResults = "focus_results" ActionDashboard = "dashboard" ActionHelp = "help" ActionServices = "services" ActionFullscreen = "fullscreen" ActionBackup = "backup" ActionExportCSV = "export_csv" ActionHistory = "history" ActionSettings = "settings" ActionImportDump = "import_dump" ActionSelectAll = "select_all" ActionClearSelection = "clear_selection" )
Variables ¶
This section is empty.
Functions ¶
func DefaultKeymapBindings ¶
DefaultKeymapBindings returns a deep copy of default key bindings.
func SaveSettings ¶
SaveSettings saves settings to ~/.config/dbterm/settings.json.
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
Name string `json:"name"`
Type DBType `json:"type"`
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
Database string `json:"database,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
FilePath string `json:"file_path,omitempty"` // SQLite only
SSLMode string `json:"ssl_mode,omitempty"` // PostgreSQL only
AccountID string `json:"account_id,omitempty"` // Cloudflare D1 only
DatabaseID string `json:"database_id,omitempty"` // Cloudflare D1 only
AuthToken string `json:"auth_token,omitempty"` // Turso & D1
LastUsed string `json:"last_used,omitempty"`
Active bool `json:"active"`
}
ConnectionConfig holds all info for a saved database connection
func (*ConnectionConfig) BuildConnString ¶
func (c *ConnectionConfig) BuildConnString() string
BuildConnString creates a driver-appropriate connection string
func (*ConnectionConfig) DisplayLabel ¶
func (c *ConnectionConfig) DisplayLabel() string
DisplayLabel returns a human-friendly label for the connection
func (*ConnectionConfig) DriverName ¶
func (c *ConnectionConfig) DriverName() string
DriverName returns the Go sql driver name for this config
func (*ConnectionConfig) TypeLabel ¶
func (c *ConnectionConfig) TypeLabel() string
TypeLabel returns a styled label for the DB type
type Settings ¶
Settings stores user-adjustable runtime settings.
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings returns a deep-copied default settings value.
func LoadSettings ¶
LoadSettings loads settings from ~/.config/dbterm/settings.json. Missing or empty files are replaced with defaults on disk.
type Store ¶
type Store struct {
Connections []ConnectionConfig `json:"connections"`
// contains filtered or unexported fields
}
Store manages the collection of saved connections
func (*Store) Add ¶
func (s *Store) Add(c ConnectionConfig) error
Add appends a new connection and saves