This repository has been archived on 2026-03-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
scabiosa/SQL/SQLInterface.go
2021-11-23 08:23:06 +01:00

35 lines
No EOL
1.4 KiB
Go

package SQL
import (
"github.com/google/uuid"
"scabiosa/Tools"
"time"
)
type SQLService interface {
createDefaultTables()
newLogEntry(uuid uuid.UUID, logType LogType, backupName string, stage SQLStage, storageType RemoteStorageType, description string, timestamp time.Time)
newBackupEntry(uuid uuid.UUID, backupName string, lastBackup time.Time, localBackup bool, filePath string, storageType RemoteStorageType, remotePath string, durationToBackup time.Duration, hadErrors bool)
}
func CreateDefaultTables(sqlService SQLService){
sqlService.createDefaultTables()
}
func NewLogEntry(sqlService SQLService, uuid uuid.UUID, logType LogType, backupName string, stage SQLStage, storageType RemoteStorageType, description string, timestamp time.Time){
sqlService.newLogEntry(uuid, logType, backupName, stage, storageType, description, timestamp)
}
func NewBackupEntry(sqlService SQLService, uuid uuid.UUID, backupName string, lastBackup time.Time, localBackup bool, filePath string, storageType RemoteStorageType, remotePath string, durationToBackup time.Duration, hadErrors bool){
sqlService.newBackupEntry(uuid, backupName, lastBackup, localBackup, filePath, storageType, remotePath, durationToBackup, hadErrors)
}
func GetSQLInstance() SQLService{
config := Tools.GetConfig()
switch config.SQLConfig.SqlType {
case "mariadb": {return GetMariaDBInstance()}
}
return nil
}