database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusBackedUp = "BACKED_UP"
	StatusRestored = "RESTORED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup struct {
	ID         int    `json:"id"`
	BackupPath string `json:"backupPath"`
	SrcPath    string `json:"srcPath"`
	DstPath    string `json:"dstPath"`
	Type       string `json:"type"`
	Status     string `json:"status"`
	CreatedAt  string `json:"createdAt"`
}

Backup is a struct which represents the backups table schema.

type DBHandler

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

DBHandler manages the SQLite database connection.

func NewDBHandler

func NewDBHandler(dbPath string) (*DBHandler, error)

NewDBHandler initializes the database and returns a handler.

func (*DBHandler) GetAll

func (handler *DBHandler) GetAll() ([]Backup, error)

GetAll returns data from the backups table.

func (*DBHandler) GetById

func (handler *DBHandler) GetById(backupId string) (*Backup, error)

GetById returns data from the backups table by id.

func (*DBHandler) Insert

func (handler *DBHandler) Insert(backupPath, srcPath, dstPath, fileType string) error

Insert inserts the given data into the backups table.

func (*DBHandler) UpdateStatus

func (handler *DBHandler) UpdateStatus(id int, status string) error

UpdateStatus updates the backups status.

Jump to

Keyboard shortcuts

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