Documentation
¶
Index ¶
- type BackupService
- func (bs *BackupService) CreateBackup(connectionParams *models.ConnectionParameters) (string, error)
- func (bs *BackupService) GetLastBackupPath(connectionParams *models.ConnectionParameters) (string, error)
- func (bs *BackupService) RestoreLastBackup(connectionParams *models.ConnectionParameters) error
- type MigrationService
- type SqlScriptsHelpers
- func (s *SqlScriptsHelpers) CalculateHash(filePath string) (string, error)
- func (s *SqlScriptsHelpers) ExecuteScript(scriptContent string, connectionParams *models.ConnectionParameters) error
- func (s *SqlScriptsHelpers) ScanForSqlFiles(directory string) ([]string, error)
- func (s *SqlScriptsHelpers) SplitSqlStatements(script string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupService ¶ added in v0.5.2
type BackupService struct {
// contains filtered or unexported fields
}
BackupService handles database backup and restore operations
func NewBackupService ¶ added in v0.5.2
func NewBackupService(isDryRun, verbose bool) *BackupService
NewBackupService creates a new backup service instance
func (*BackupService) CreateBackup ¶ added in v0.5.2
func (bs *BackupService) CreateBackup(connectionParams *models.ConnectionParameters) (string, error)
CreateBackup creates a backup of the database
func (*BackupService) GetLastBackupPath ¶ added in v0.5.2
func (bs *BackupService) GetLastBackupPath(connectionParams *models.ConnectionParameters) (string, error)
GetLastBackupPath returns the path to the most recent backup file
func (*BackupService) RestoreLastBackup ¶ added in v0.5.2
func (bs *BackupService) RestoreLastBackup(connectionParams *models.ConnectionParameters) error
RestoreLastBackup restores the most recent backup
type MigrationService ¶
type MigrationService struct {
// contains filtered or unexported fields
}
MigrationService handles the execution of database migrations
func NewMigrationService ¶
func NewMigrationService(isDryRun, verbose bool, backupService *BackupService) *MigrationService
NewMigrationService creates a new migration service instance
func (*MigrationService) Run ¶
func (ms *MigrationService) Run(scriptsPath string, connectionParams *models.ConnectionParameters) error
Run executes the migration process
type SqlScriptsHelpers ¶
type SqlScriptsHelpers struct{}
SqlScriptsHelpers provides utilities for SQL script operations
func NewSqlScriptsHelpers ¶
func NewSqlScriptsHelpers() *SqlScriptsHelpers
NewSqlScriptsHelpers creates a new SqlScriptsHelpers instance
func (*SqlScriptsHelpers) CalculateHash ¶
func (s *SqlScriptsHelpers) CalculateHash(filePath string) (string, error)
CalculateHash calculates the SHA256 hash of a file
func (*SqlScriptsHelpers) ExecuteScript ¶
func (s *SqlScriptsHelpers) ExecuteScript(scriptContent string, connectionParams *models.ConnectionParameters) error
ExecuteScript executes a SQL script against the database
func (*SqlScriptsHelpers) ScanForSqlFiles ¶
func (s *SqlScriptsHelpers) ScanForSqlFiles(directory string) ([]string, error)
ScanForSqlFiles scans a directory for SQL files and returns them in breadth-first order Execution order: 1. Files in the target directory (ignoring subdirectories), ordered alphabetically 2. For each subdirectory in alphabetical order:
- Files directly under it, ordered alphabetically
- Then recursively process its subdirectories in the same manner
func (*SqlScriptsHelpers) SplitSqlStatements ¶
func (s *SqlScriptsHelpers) SplitSqlStatements(script string) []string
SplitSqlStatements splits a SQL script into individual statements This handles complex scripts including stored procedures, functions, and other constructs