Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupManager ¶ added in v0.7.0
type BackupManager struct { Config *config.Configuration // Configuration settings for backup operations S3Client *s3.S3 // AWS S3 client for uploading backups to S3 }
BackupManager manages database backups, supporting both local disk and S3 storage.
func NewBackupManager ¶ added in v0.7.0
func NewBackupManager() (*BackupManager, error)
NewBackupManager initializes a BackupManager with configurations for local and S3 storage. It returns a BackupManager or an error if the configuration or AWS session creation fails.
Returns: - *BackupManager: A new instance of BackupManager with initialized configuration and S3 client. - error: An error if configuration fetching or S3 session initialization fails.
func (*BackupManager) BackupToDisk ¶ added in v0.7.0
func (bm *BackupManager) BackupToDisk(ctx context.Context) (string, error)
BackupToDisk creates a backup of the PostgreSQL database and stores it locally on disk. It creates a directory based on the current date and stores the backup as a SQL file.
Parameters: - ctx context.Context: The context for managing cancellation and deadlines.
Returns: - string: The path to the backup file. - error: An error if the backup process fails.
func (*BackupManager) BackupToS3 ¶ added in v0.7.0
func (bm *BackupManager) BackupToS3(ctx context.Context) error
BackupToS3 performs a database backup and uploads the resulting file to an S3 bucket. It first calls BackupToDisk to create a local backup, then uploads the file to S3.
Parameters: - ctx context.Context: The context for managing cancellation and deadlines.
Returns: - error: An error if the backup process or upload to S3 fails.