Documentation
¶
Index ¶
- Constants
- type App
- func (a *App) CloseConnectionsWindow()
- func (a *App) CloseEditConnectionWindow()
- func (a *App) CloseMainWindow()
- func (a *App) ClosePluginsWindow()
- func (a *App) MaximiseMainWindow()
- func (a *App) MinimiseMainWindow()
- func (a *App) NewAppMenu() *application.Menu
- func (a *App) NewConnectionsWindow() *application.WebviewWindow
- func (a *App) NewEditConnectionWindow() *application.WebviewWindow
- func (a *App) NewMainWindow() *application.WebviewWindow
- func (a *App) NewPluginsWindow() *application.WebviewWindow
- func (a *App) OpenFileDialog() (string, error)
- func (a *App) OpenURL(url string)
- func (a *App) Quit()
- func (a *App) ShowAboutDialog()
- func (a *App) ShowConnectionsWindow()
- func (a *App) ShowEditConnectionWindow(id string)
- func (a *App) ShowPluginsWindow()
- func (a *App) ToggleFullScreenMainWindow()
- type Connection
- type ConnectionCreatedEvent
- type ConnectionDeletedEvent
- type ConnectionService
- func (s *ConnectionService) CreateConnection(ctx context.Context, name, driverType, credential string) (Connection, error)
- func (s *ConnectionService) DeleteConnection(ctx context.Context, id string) error
- func (s *ConnectionService) GetConnection(ctx context.Context, id string) (Connection, error)
- func (s *ConnectionService) GetCredential(ctx context.Context, id string) (string, error)
- func (s *ConnectionService) ListConnections(ctx context.Context) ([]Connection, error)
- func (s *ConnectionService) SetApp(app *application.App)
- func (s *ConnectionService) Shutdown()
- func (s *ConnectionService) UpdateConnection(ctx context.Context, id, name, credential string) (Connection, error)
- type ConnectionUpdatedEvent
- type EditConnectionWindowOpenedEvent
- type EventEmitter
- type LogEntry
- type LogLevel
- type WailsEmitter
Constants ¶
const ( // EventAppLog is emitted by every service to stream structured log entries. EventAppLog = "app:log" // EventConnectionCreated is emitted after a connection is successfully persisted. EventConnectionCreated = "connection:created" // EventConnectionUpdated is emitted after a connection is successfully updated. EventConnectionUpdated = "connection:updated" // EventConnectionDeleted is emitted after a connection is successfully removed. EventConnectionDeleted = "connection:deleted" // EventMenuLogsToggled is emitted by the native menu to request the frontend toggle the logs panel. EventMenuLogsToggled = "menu:logs-toggled" // EventConnectionsWindowClosed is emitted when the connections window is hidden. EventConnectionsWindowClosed = "connections-window:closed" // EventEditConnectionWindowOpened is emitted when the edit-connection window is shown, carrying the target connection ID. EventEditConnectionWindowOpened = "edit-connection-window:opened" // EventEditConnectionWindowClosed is emitted when the edit-connection window is hidden. EventEditConnectionWindowClosed = "edit-connection-window:closed" // EventPluginsReady is emitted by the plugin manager once the initial async // scan has completed and ListPlugins() returns a populated result. EventPluginsReady = "plugins:ready" )
Event name constants. All domain events are emitted exclusively from the backend. The frontend must never call Events.Emit for these topics; it only subscribes and reacts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
App *application.App
MainWindow *application.WebviewWindow
ConnectionsWindow *application.WebviewWindow
// PluginsWindow is a secondary window used to display the plugin list.
PluginsWindow *application.WebviewWindow
// EditConnectionWindow is a secondary window used to edit an existing connection.
EditConnectionWindow *application.WebviewWindow
}
func NewAppService ¶
func NewAppService() *App
NewAppService creates a new instance of the App service, which provides methods for controlling the main application window and the connections window.
func (*App) CloseConnectionsWindow ¶
func (a *App) CloseConnectionsWindow()
CloseConnectionsWindow hides the connections window and sends it to the back.
func (*App) CloseEditConnectionWindow ¶
func (a *App) CloseEditConnectionWindow()
CloseEditConnectionWindow hides the edit-connection window and emits the closed event.
func (*App) CloseMainWindow ¶
func (a *App) CloseMainWindow()
CloseMainWindow closes the main application window and initiates a full application shutdown. Historically the UI called this method when the user selected Quit from the menu or pressed the window close button. Merely closing the webview did not terminate the Go process if there were other hidden windows or background services running, which led to the issue where the app would remain alive in the background. We now call a.App.Quit() as well, which causes app.Run() to return and services to be torn down.
func (*App) ClosePluginsWindow ¶
func (a *App) ClosePluginsWindow()
ClosePluginsWindow hides the plugins window.
func (*App) MaximiseMainWindow ¶
func (a *App) MaximiseMainWindow()
MaximiseMainWindow maximises the main application window to use the full screen size.
func (*App) MinimiseMainWindow ¶
func (a *App) MinimiseMainWindow()
MinimiseMainWindow minimises the main application window.
func (*App) NewAppMenu ¶
func (a *App) NewAppMenu() *application.Menu
func (*App) NewConnectionsWindow ¶
func (a *App) NewConnectionsWindow() *application.WebviewWindow
NewConnectionsWindow creates a new connections window with specific options and event handlers to manage its behavior. The window is initially hidden and configured to prevent resizing, maximising, and minimising. It also includes OS-specific options for the title bar and backdrop.
func (*App) NewEditConnectionWindow ¶
func (a *App) NewEditConnectionWindow() *application.WebviewWindow
NewEditConnectionWindow creates a new edit-connection window, initially hidden. The window mirrors the connections window options and is reused across sessions.
func (*App) NewMainWindow ¶
func (a *App) NewMainWindow() *application.WebviewWindow
NewMainWindow creates a new main application window with specific options and returns it.
func (*App) NewPluginsWindow ¶
func (a *App) NewPluginsWindow() *application.WebviewWindow
NewPluginsWindow creates a new plugins window, mirroring the behaviour of the connections window. The window is initially hidden and will be reused rather than re-created each time it is shown.
func (*App) OpenFileDialog ¶
OpenFileDialog opens a native file picker and returns the selected file path. Returns an empty string if the user cancels.
func (*App) Quit ¶
func (a *App) Quit()
Quit requests that the entire application shutdown. In addition to closing the main window (which happens automatically), this causes app.Run() to return and triggers Shutdown on any bound services.
func (*App) ShowAboutDialog ¶
func (a *App) ShowAboutDialog()
ShowAboutDialog displays a native About dialog for the application.
func (*App) ShowConnectionsWindow ¶
func (a *App) ShowConnectionsWindow()
ShowConnectionsWindow shows the connections window and brings it to the front.
func (*App) ShowEditConnectionWindow ¶
ShowEditConnectionWindow emits the opened event (carrying the connection ID) and then shows the edit-connection window, constructing it if necessary.
func (*App) ShowPluginsWindow ¶
func (a *App) ShowPluginsWindow()
ShowPluginsWindow shows the plugins window, constructing it if necessary.
func (*App) ToggleFullScreenMainWindow ¶
func (a *App) ToggleFullScreenMainWindow()
ToggleFullScreenMainWindow toggles the main application window between fullscreen and windowed mode.
type Connection ¶
type Connection struct {
ID string `json:"id"`
Name string `json:"name"`
DriverType string `json:"driver_type"`
CredentialKey string `json:"credential_key"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Connection represents a persisted connection record. NOTE: `CredentialKey` stores a key (not the secret) that the CredManager uses to fetch the secret from the OS keyring.
type ConnectionCreatedEvent ¶
type ConnectionCreatedEvent struct {
Connection Connection `json:"connection"`
}
ConnectionCreatedEvent is the payload emitted on EventConnectionCreated.
type ConnectionDeletedEvent ¶
type ConnectionDeletedEvent struct {
ID string `json:"id"`
}
ConnectionDeletedEvent is the payload emitted on EventConnectionDeleted.
type ConnectionService ¶
type ConnectionService struct {
// contains filtered or unexported fields
}
ConnectionService is the application-facing service that exposes connection management APIs to the frontend. The service now embeds the persistence and credential-storage logic (previously in connection.ConnectionManager). It is safe for concurrent use.
func NewConnectionService ¶
func NewConnectionService() (*ConnectionService, error)
NewConnectionService constructs a ConnectionService and initializes the underlying SQLite database and credential manager. It returns an error if the database cannot be opened or initialized.
func (*ConnectionService) CreateConnection ¶
func (s *ConnectionService) CreateConnection(ctx context.Context, name, driverType, credential string) (Connection, error)
CreateConnection inserts a new connection record and returns it. The provided `credential` (typically the frontend-serialized auth form) is stored in the OS keyring and the DB only keeps the key reference. The driverType is normalized so that ".exe" suffixes are never stored.
func (*ConnectionService) DeleteConnection ¶
func (s *ConnectionService) DeleteConnection(ctx context.Context, id string) error
DeleteConnection removes a connection by id and attempts to remove the associated secret from the keyring as a best-effort cleanup.
func (*ConnectionService) GetConnection ¶
func (s *ConnectionService) GetConnection(ctx context.Context, id string) (Connection, error)
GetConnection retrieves a single connection by id.
func (*ConnectionService) GetCredential ¶
GetCredential retrieves the raw credential blob associated with the connection. This is used by the frontend when it needs to establish a plugin connection (e.g. building a tree or executing a query). The value was originally supplied when the connection was created and is stored via CredManager. Returning the credential to the caller is considered a security-sensitive operation, but the frontend already has full access to a saved connection (it can execute arbitrary queries), so this method simply fetches and returns whatever string is stored under the connection's key.
func (*ConnectionService) ListConnections ¶
func (s *ConnectionService) ListConnections(ctx context.Context) ([]Connection, error)
ListConnections returns all stored connections ordered by creation time (newest first).
func (*ConnectionService) SetApp ¶
func (s *ConnectionService) SetApp(app *application.App)
SetApp injects the Wails application reference so the service can emit log events to the frontend. Call this after application.New returns.
func (*ConnectionService) Shutdown ¶
func (s *ConnectionService) Shutdown()
Shutdown releases resources held by the service. It is invoked by Wails when the application is quitting.
func (*ConnectionService) UpdateConnection ¶
func (s *ConnectionService) UpdateConnection(ctx context.Context, id, name, credential string) (Connection, error)
UpdateConnection updates the name and credential of an existing connection. The credential key in the keyring is reused — only the stored value is overwritten — so the DB row never changes its credential_key reference.
type ConnectionUpdatedEvent ¶
type ConnectionUpdatedEvent struct {
Connection Connection `json:"connection"`
}
ConnectionUpdatedEvent is the payload emitted on EventConnectionUpdated.
type EditConnectionWindowOpenedEvent ¶
type EditConnectionWindowOpenedEvent struct {
ID string `json:"id"`
}
EditConnectionWindowOpenedEvent is the payload emitted on EventEditConnectionWindowOpened.
type EventEmitter ¶
type EventEmitter interface {
EmitEvent(name string, data interface{})
}
EventEmitter abstracts event emission so that services can be tested without a running Wails application. The Wails *application.App type satisfies this interface via its Event.Emit method; tests may provide a no-op or recording implementation.
type LogEntry ¶
type LogEntry struct {
Level LogLevel `json:"level"`
Message string `json:"message"`
Timestamp string `json:"timestamp"` // RFC3339Nano UTC
}
LogEntry is the payload emitted on the EventAppLog event.
type WailsEmitter ¶
type WailsEmitter struct {
App *application.App
}
WailsEmitter wraps a *application.App to satisfy EventEmitter.
func (*WailsEmitter) EmitEvent ¶
func (w *WailsEmitter) EmitEvent(name string, data interface{})