Documentation
¶
Overview ¶
Package integration provides shared functionality for integrating GoPCA Desktop and GoCSV Desktop applications, including app detection and launching.
Index ¶
- func CleanupGoPCATempFiles() error
- func GetCommonPaths(appName string) []string
- func IsAppRunning(appName string) bool
- func LaunchWithFile(appPath, filePath string) error
- func StandardizeJSONTags(fieldName string, omitempty bool) string
- func ValidateJSONMarshaling(v interface{}) error
- type AppConfig
- type AppStatus
- type Event
- type EventBus
- func (eb *EventBus) Clear()
- func (eb *EventBus) GetHistory() []Event
- func (eb *EventBus) Publish(event Event)
- func (eb *EventBus) PublishAsync(ctx context.Context, event Event)
- func (eb *EventBus) Subscribe(eventType EventType, handler EventHandler) func()
- func (eb *EventBus) Unsubscribe(eventType EventType, handler EventHandler)
- type EventHandler
- type EventType
- type JSONFieldConsistency
- type ProgressTracker
- type TempFileManager
- type WailsEventAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupGoPCATempFiles ¶ added in v0.9.10
func CleanupGoPCATempFiles() error
CleanupGoPCATempFiles removes old GoPCA temporary files from the system temp directory
func GetCommonPaths ¶
GetCommonPaths returns platform-specific common installation paths for an application
func IsAppRunning ¶
IsAppRunning checks if an application is currently running
func LaunchWithFile ¶
LaunchWithFile launches an application with a file argument
func StandardizeJSONTags ¶ added in v0.9.10
StandardizeJSONTags returns recommended JSON tags for consistent serialization
func ValidateJSONMarshaling ¶ added in v0.9.10
func ValidateJSONMarshaling(v interface{}) error
ValidateJSONMarshaling validates that a struct can be marshaled/unmarshaled without data loss
Types ¶
type AppConfig ¶
type AppConfig struct {
Name string // Application name (e.g., "gopca-desktop", "gocsv")
CommonPaths []string // Common installation paths to check
DisplayName string // User-friendly name for error messages
}
AppConfig contains configuration for detecting and launching an application
type AppStatus ¶
type AppStatus struct {
Installed bool `json:"installed"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
AppStatus represents the installation status of an external application
type Event ¶ added in v0.9.10
type Event struct {
Type EventType `json:"type"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
Event represents an application event
type EventBus ¶ added in v0.9.10
type EventBus struct {
// contains filtered or unexported fields
}
EventBus manages application-wide events
func NewEventBus ¶ added in v0.9.10
func NewEventBus() *EventBus
NewEventBus creates a new event bus
func (*EventBus) Clear ¶ added in v0.9.10
func (eb *EventBus) Clear()
Clear removes all handlers and history
func (*EventBus) GetHistory ¶ added in v0.9.10
GetHistory returns recent events
func (*EventBus) PublishAsync ¶ added in v0.9.10
PublishAsync publishes an event asynchronously with context
func (*EventBus) Subscribe ¶ added in v0.9.10
func (eb *EventBus) Subscribe(eventType EventType, handler EventHandler) func()
Subscribe registers a handler for an event type
func (*EventBus) Unsubscribe ¶ added in v0.9.10
func (eb *EventBus) Unsubscribe(eventType EventType, handler EventHandler)
Unsubscribe removes a handler for an event type
type EventHandler ¶ added in v0.9.10
type EventHandler func(event Event)
EventHandler is a function that handles events
type EventType ¶ added in v0.9.10
type EventType string
EventType represents different types of events in the application
const ( // EventDataLoaded fired when CSV data is loaded EventDataLoaded EventType = "data-loaded" // EventPCAStarted fired when PCA analysis starts EventPCAStarted EventType = "pca-started" // EventPCACompleted fired when PCA analysis completes EventPCACompleted EventType = "pca-completed" // EventPCAFailed fired when PCA analysis fails EventPCAFailed EventType = "pca-failed" // EventExportStarted fired when data export starts EventExportStarted EventType = "export-started" // EventExportCompleted fired when data export completes EventExportCompleted EventType = "export-completed" // EventAppLaunched fired when companion app is launched EventAppLaunched EventType = "app-launched" // EventProgressUpdate fired for progress updates EventProgressUpdate EventType = "progress-update" )
type JSONFieldConsistency ¶ added in v0.9.10
type JSONFieldConsistency struct {
GoFieldName string
JSONTag string
TSFieldName string
Inconsistent bool
}
JSONFieldConsistency checks for consistency between Go struct JSON tags and TypeScript interfaces
func CheckJSONConsistency ¶ added in v0.9.10
func CheckJSONConsistency(v interface{}) ([]JSONFieldConsistency, error)
CheckJSONConsistency validates that JSON tags follow consistent naming conventions
type ProgressTracker ¶ added in v0.9.10
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker tracks progress of long-running operations
func NewProgressTracker ¶ added in v0.9.10
func NewProgressTracker(eventBus *EventBus, operation string, total int) *ProgressTracker
NewProgressTracker creates a new progress tracker
func (*ProgressTracker) Complete ¶ added in v0.9.10
func (pt *ProgressTracker) Complete()
Complete marks the operation as complete
func (*ProgressTracker) Update ¶ added in v0.9.10
func (pt *ProgressTracker) Update(current int)
Update updates the progress and publishes an event
type TempFileManager ¶ added in v0.9.10
type TempFileManager struct {
// contains filtered or unexported fields
}
TempFileManager manages temporary files created for app-to-app communication
func NewTempFileManager ¶ added in v0.9.10
func NewTempFileManager() *TempFileManager
NewTempFileManager creates a new temporary file manager
func (*TempFileManager) CleanupOldFiles ¶ added in v0.9.10
func (m *TempFileManager) CleanupOldFiles()
CleanupOldFiles removes temporary files older than maxAge
func (*TempFileManager) CreateTempFile ¶ added in v0.9.10
func (m *TempFileManager) CreateTempFile(prefix, extension string) (string, error)
CreateTempFile creates a temporary file with a unique name
func (*TempFileManager) RegisterTempFile ¶ added in v0.9.10
func (m *TempFileManager) RegisterTempFile(filepath string)
RegisterTempFile registers a temporary file for tracking
func (*TempFileManager) Stop ¶ added in v0.9.10
func (m *TempFileManager) Stop()
Stop stops the cleanup routine
type WailsEventAdapter ¶ added in v0.9.10
type WailsEventAdapter struct {
// contains filtered or unexported fields
}
WailsEventAdapter adapts EventBus events to Wails runtime events
func NewWailsEventAdapter ¶ added in v0.9.10
func NewWailsEventAdapter(ctx context.Context, eventBus *EventBus) *WailsEventAdapter
NewWailsEventAdapter creates a new adapter for Wails events
func (*WailsEventAdapter) EmitToFrontend ¶ added in v0.9.10
func (adapter *WailsEventAdapter) EmitToFrontend(event Event) error
EmitToFrontend converts an Event to JSON and emits it to the frontend