chore: add convert backup size from bytes to Mib
This commit is contained in:
@@ -63,7 +63,7 @@ func azureBackup(db *dbConfig, config *BackupConfig) {
|
||||
// Send notification
|
||||
utils.NotifySuccess(&utils.NotificationData{
|
||||
File: finalFileName,
|
||||
BackupSize: backupSize,
|
||||
BackupSize: utils.BytesToMb(uint64(backupSize)),
|
||||
Database: db.dbName,
|
||||
Storage: config.storage,
|
||||
BackupLocation: filepath.Join(config.remotePath, finalFileName),
|
||||
|
||||
@@ -290,7 +290,7 @@ func localBackup(db *dbConfig, config *BackupConfig) {
|
||||
// Send notification
|
||||
utils.NotifySuccess(&utils.NotificationData{
|
||||
File: finalFileName,
|
||||
BackupSize: backupSize,
|
||||
BackupSize: utils.BytesToMb(uint64(backupSize)),
|
||||
Database: db.dbName,
|
||||
Storage: config.storage,
|
||||
BackupLocation: filepath.Join(storagePath, finalFileName),
|
||||
|
||||
@@ -92,7 +92,7 @@ func sshBackup(db *dbConfig, config *BackupConfig) {
|
||||
// Send notification
|
||||
utils.NotifySuccess(&utils.NotificationData{
|
||||
File: finalFileName,
|
||||
BackupSize: backupSize,
|
||||
BackupSize: utils.BytesToMb(uint64(backupSize)),
|
||||
Database: db.dbName,
|
||||
Storage: config.storage,
|
||||
BackupLocation: filepath.Join(config.remotePath, finalFileName),
|
||||
@@ -204,7 +204,7 @@ func ftpBackup(db *dbConfig, config *BackupConfig) {
|
||||
// Send notification
|
||||
utils.NotifySuccess(&utils.NotificationData{
|
||||
File: finalFileName,
|
||||
BackupSize: backupSize,
|
||||
BackupSize: utils.BytesToMb(uint64(backupSize)),
|
||||
Database: db.dbName,
|
||||
Storage: config.storage,
|
||||
BackupLocation: filepath.Join(config.remotePath, finalFileName),
|
||||
|
||||
@@ -93,7 +93,7 @@ func s3Backup(db *dbConfig, config *BackupConfig) {
|
||||
// Send notification
|
||||
utils.NotifySuccess(&utils.NotificationData{
|
||||
File: finalFileName,
|
||||
BackupSize: backupSize,
|
||||
BackupSize: utils.BytesToMb(uint64(backupSize)),
|
||||
Database: db.dbName,
|
||||
Storage: config.storage,
|
||||
BackupLocation: filepath.Join(config.remotePath, finalFileName),
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
<h3>Failure Details:</h3>
|
||||
<ul>
|
||||
<li><strong>Database Name:</strong> {{.DatabaseName}}</li>
|
||||
<li><strong>Error Message:</strong> {{.Error}}</li>
|
||||
<li><strong>Date:</strong> {{.EndTime}}</li>
|
||||
<li><strong>Backup Reference:</strong> {{.BackupReference}}</li>
|
||||
<li><strong>Error Message:</strong> {{.Error}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<li><strong>Backup End Time:</strong> {{.EndTime}}</li>
|
||||
<li><strong>Backup Storage:</strong> {{.Storage}}</li>
|
||||
<li><strong>Backup Location:</strong> {{.BackupLocation}}</li>
|
||||
<li><strong>Backup Size:</strong> {{.BackupSize}} bytes</li>
|
||||
<li><strong>Backup Size:</strong> {{.BackupSize}} MiB</li>
|
||||
<li><strong>Backup Reference:</strong> {{.BackupReference}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@ Backup Details:
|
||||
- Backup EndTime: {{.EndTime}}
|
||||
- Backup Storage: {{.Storage}}
|
||||
- Backup Location: {{.BackupLocation}}
|
||||
- Backup Size: {{.BackupSize}} bytes
|
||||
- Backup Size: {{.BackupSize}} MiB
|
||||
- Backup Reference: {{.BackupReference}}
|
||||
|
||||
You can access the backup at the specified location if needed.
|
||||
@@ -37,7 +37,7 @@ type MailConfig struct {
|
||||
}
|
||||
type NotificationData struct {
|
||||
File string
|
||||
BackupSize int64
|
||||
BackupSize uint64
|
||||
Database string
|
||||
StartTime string
|
||||
EndTime string
|
||||
|
||||
@@ -254,3 +254,7 @@ func CronNextTime(cronExpr string) time.Time {
|
||||
next := schedule.Next(now)
|
||||
return next
|
||||
}
|
||||
|
||||
func BytesToMb(b uint64) uint64 {
|
||||
return b / 1024 / 1024
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user