refactor: Flatten directory structure
Move project files from uzdb/ subdirectory to root directory for cleaner project structure.
Changes:
- Move frontend/ to root
- Move internal/ to root
- Move build/ to root
- Move all config files (go.mod, wails.json, etc.) to root
- Remove redundant uzdb/ subdirectory nesting
Project structure is now:
├── frontend/ # React application
├── internal/ # Go backend
├── build/ # Wails build assets
├── doc/ # Design documentation
├── main.go # Entry point
└── ...
🤖 Generated with Qoder
This commit is contained in:
58
internal/models/query.go
Normal file
58
internal/models/query.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// QueryHistory represents a record of executed queries
|
||||
type QueryHistory struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
ConnectionID string `gorm:"type:varchar(36);not null;index" json:"connection_id"`
|
||||
SQL string `gorm:"type:text;not null" json:"sql"`
|
||||
Duration int64 `gorm:"type:bigint" json:"duration_ms"` // Duration in milliseconds
|
||||
ExecutedAt time.Time `gorm:"autoCreateTime;index" json:"executed_at"`
|
||||
RowsAffected int64 `gorm:"type:bigint" json:"rows_affected"`
|
||||
Error string `gorm:"type:text" json:"error,omitempty"`
|
||||
Success bool `gorm:"type:boolean;default:false" json:"success"`
|
||||
ResultPreview string `gorm:"type:text" json:"result_preview,omitempty"` // JSON preview of first few rows
|
||||
}
|
||||
|
||||
// TableName returns the table name for QueryHistory
|
||||
func (QueryHistory) TableName() string {
|
||||
return "query_history"
|
||||
}
|
||||
|
||||
// SavedQuery represents a saved SQL query
|
||||
type SavedQuery struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"type:varchar(255);not null" json:"name"`
|
||||
Description string `gorm:"type:text" json:"description"`
|
||||
SQL string `gorm:"type:text;not null" json:"sql"`
|
||||
ConnectionID string `gorm:"type:varchar(36);index" json:"connection_id"`
|
||||
Tags string `gorm:"type:text" json:"tags"` // Comma-separated tags
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for SavedQuery
|
||||
func (SavedQuery) TableName() string {
|
||||
return "saved_queries"
|
||||
}
|
||||
|
||||
// CreateSavedQueryRequest represents a request to save a query
|
||||
type CreateSavedQueryRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
SQL string `json:"sql" binding:"required"`
|
||||
ConnectionID string `json:"connection_id"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
||||
// UpdateSavedQueryRequest represents a request to update a saved query
|
||||
type UpdateSavedQueryRequest struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
SQL string `json:"sql"`
|
||||
ConnectionID string `json:"connection_id"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
Reference in New Issue
Block a user