database

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupRepoInserter

type BackupRepoInserter interface {
	InsertOrUpdateBackupRepo(backupRepo *backuprepo.BackupRepo) error
}

type BackupRepoNameGetter

type BackupRepoNameGetter interface {
	GetBackupRepoByName(name string) (*backuprepo.BackupRepo, error)
}

type BackupReposGetter

type BackupReposGetter interface {
	GetAllBackupRepos() ([]*backuprepo.BackupRepo, error)
}

type Database

type Database struct {
	*sqlx.DB
	BackupRepoProcessor backuprepo.BackupRepoProcessor
	StoragesInserter    StoragesInserter
}

func ConnectDB

func ConnectDB() (*Database, error)

func (*Database) CloseDB

func (db *Database) CloseDB()

func (*Database) GetAllBackupRepos

func (db *Database) GetAllBackupRepos() ([]*backuprepo.BackupRepo, error)

GetAllBackupRepoConfigs retrieves all stored BackupRepoConfig from the database.

func (*Database) GetBackupRepoByName

func (db *Database) GetBackupRepoByName(name string) (*backuprepo.BackupRepo, error)

func (*Database) InsertOrUpdateBackupRepo

func (db *Database) InsertOrUpdateBackupRepo(backupRepo *backuprepo.BackupRepo) error

func (*Database) MigrateDB

func (db *Database) MigrateDB() error

type StoragesInserter

type StoragesInserter interface {
	InsertOrUpdateStorages(tx *sqlx.Tx, backupRepoName string, storages map[string]storage.Storage) error
}

type StoragesInserterImpl

type StoragesInserterImpl struct{}

func (*StoragesInserterImpl) InsertOrUpdateStorages

func (s *StoragesInserterImpl) InsertOrUpdateStorages(tx *sqlx.Tx, backupRepoName string, storages map[string]storage.Storage) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL