database

package
v0.0.0-...-f2f83b6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB() error

Creates database if doesnt exist

func GenConditionSQL

func GenConditionSQL(source_ids []int64, archive_names []string) ([]interface{}, string)

Types

type Archive

type Archive struct {
	Id   int64
	Name string
}

type Backup

type Backup struct {
	Ksuid string
	Path  sql.NullString
}

type BackupPaths

type BackupPaths struct {
	Sources     []string
	SourceIDs   []int64
	Destination string
	BackupKsuid string
}

type BackupRel

type BackupRel struct {
	Source      Source
	Backup      []Backup
	Archive     Archive
	Archived_at sql.NullTime
}

type DriveRecord

type DriveRecord struct {
	Letter         string
	Name           string
	File_exists    bool
	File_accesible bool
	Ksuid          string
	Timestamp      string
}

type SQLite

type SQLite struct {
	// contains filtered or unexported fields
}

func (*SQLite) AddBackupTimestamp

func (conn *SQLite) AddBackupTimestamp(source_id int64, drive_ksuid string) int

func (*SQLite) ArchiveExists

func (conn *SQLite) ArchiveExists(archive_name string) bool

func (*SQLite) ArchiveUsed

func (conn *SQLite) ArchiveUsed(archive_id int64) (int, int)

func (*SQLite) ClearAllTables

func (conn *SQLite) ClearAllTables() error

func (*SQLite) CreateArchive

func (conn *SQLite) CreateArchive(archive_name string) (int64, error)

func (*SQLite) CreateBackup

func (conn *SQLite) CreateBackup(archive_id int64, drive_ksuid string, path string) error

func (*SQLite) CreateSource

func (conn *SQLite) CreateSource(drive_ksuid string, path string) int64

func (*SQLite) DelArchiveDB

func (conn *SQLite) DelArchiveDB(archive_id int64) bool

Removes record from drives table

func (*SQLite) DelDriveDB

func (conn *SQLite) DelDriveDB(ksuid string) bool

Removes record from drives table

func (*SQLite) DriveInDB

func (conn *SQLite) DriveInDB(drive_ksuid string) (string, sql.NullString)

Returns drive by ksuid from db

func (*SQLite) Exec

func (conn *SQLite) Exec(sql string, args ...interface{}) (sql.Result, error)

func (*SQLite) FindBackups

func (conn *SQLite) FindBackups(source_ids []int64, archive_names []string) (map[int64]BackupRel, error)

func (*SQLite) Fixtures

func (conn *SQLite) Fixtures() error

func (*SQLite) GetArchiveID

func (conn *SQLite) GetArchiveID(archive_name string) int64

func (*SQLite) GetArchives

func (conn *SQLite) GetArchives() []Archive

func (*SQLite) GetArchivesWithoutBackup

func (conn *SQLite) GetArchivesWithoutBackup() []int64

func (*SQLite) GetNewestTimestamp

func (conn *SQLite) GetNewestTimestamp(database_path string) sql.NullTime

func (*SQLite) GetSourceArchive

func (conn *SQLite) GetSourceArchive(source_id int64) int64

Removes record from source table

func (*SQLite) GetSourcesWithoutBackup

func (conn *SQLite) GetSourcesWithoutBackup() []int64

func (*SQLite) InsertDriveDB

func (conn *SQLite) InsertDriveDB(ksuid string, drive_name string) int64

Inserts record into table drives

func (*SQLite) OpenConnection

func (conn *SQLite) OpenConnection(database_path string) error

func (*SQLite) QueryRows

func (conn *SQLite) QueryRows(sql string, args ...interface{}) (rows.Rows, error)

func (*SQLite) RemoveDestination

func (conn *SQLite) RemoveDestination(archive_id int64, drive_ksuid string) bool

Removes record from drives table

func (*SQLite) RemoveDestinationByArchive

func (conn *SQLite) RemoveDestinationByArchive(archive_id int64) bool

Removes record from drives table

func (*SQLite) RemoveDestinationByDrive

func (conn *SQLite) RemoveDestinationByDrive(drive_ksuid string) bool

Removes record from drives table

func (*SQLite) RemoveDestinationByPath

func (conn *SQLite) RemoveDestinationByPath(archive_name string, ksuid string) bool

func (*SQLite) RemoveDestinations

func (conn *SQLite) RemoveDestinations(archive_id int64) bool

Removes record from drives table

func (*SQLite) RemoveSource

func (conn *SQLite) RemoveSource(source_id int64) error

Removes record from source table

func (*SQLite) RemoveSources

func (conn *SQLite) RemoveSources(archive_id int64) bool

Removes record from source table

func (*SQLite) TestDatabase

func (conn *SQLite) TestDatabase(database_path string) map[int64]Timestamp

func (*SQLite) UpdateDriveName

func (conn *SQLite) UpdateDriveName(drive_ksuid string, new_name string) int

func (*SQLite) UpdateSourceArchive

func (conn *SQLite) UpdateSourceArchive(source_id int64, archive_id int64) error

type Source

type Source struct {
	Id    int64
	Ksuid string
	Path  sql.NullString
}

type Timestamp

type Timestamp struct {
	Source_id   int64
	Drive_ksuid string
	Archived_at sql.NullTime
}

Jump to

Keyboard shortcuts

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