Documentation
¶
Index ¶
- func FormatSize(bytes int64) string
- func GetGitHead(projectPath string) string
- func HasChanges(projectPath string, lastBackup *manifest.BackupEntry) (bool, string)
- func ListProjects(sourceDir string) ([]string, error)
- type BackupResult
- type Service
- func (s *Service) BackupProject(cfg *config.Config, project string) BackupResult
- func (s *Service) GetGitHead(projectPath string) string
- func (s *Service) HasChanges(projectPath string, lastBackup *manifest.BackupEntry) (bool, string)
- func (s *Service) ListProjects(sourceDir string) ([]string, error)
- func (s *Service) RunBackup(cfg *config.Config) ([]BackupResult, error)
- type ZipResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGitHead ¶
GetGitHead returns the current HEAD commit hash for a git repo. Uses the default production dependencies.
func HasChanges ¶
func HasChanges(projectPath string, lastBackup *manifest.BackupEntry) (bool, string)
HasChanges checks if project has changed since last backup. Uses the default production dependencies.
func ListProjects ¶
ListProjects returns all directories in the source directory. Uses the default production dependencies.
Types ¶
type BackupResult ¶
type BackupResult struct {
Project string
ZipPath string
Size int64
FileCount int
GitHead string
Skipped bool
Reason string
Error error
}
BackupResult contains the result of a backup operation.
func BackupProject ¶
func BackupProject(cfg *config.Config, project string) BackupResult
BackupProject creates a zip backup of a single project. Uses the default production dependencies.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides backup operations with injected dependencies.
func NewDefaultService ¶
func NewDefaultService() *Service
NewDefaultService creates a backup service with real production dependencies.
func NewService ¶
NewService creates a new backup service with the given dependencies.
func (*Service) BackupProject ¶
func (s *Service) BackupProject(cfg *config.Config, project string) BackupResult
BackupProject creates a zip backup of a single project.
func (*Service) GetGitHead ¶
GetGitHead returns the current HEAD commit hash for a git repo.
func (*Service) HasChanges ¶
HasChanges checks if project has changed since last backup.
func (*Service) ListProjects ¶
ListProjects returns all directories in the source directory.