vaultfiles

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteVaultFile

func DeleteVaultFile(path string) error

func GetDeletedFiles

func GetDeletedFiles() (any, error)

func GetVaultSize

func GetVaultSize(vaultID string) (int, error)

func InsertData

func InsertData(uid int, data *[]byte) error

func InsertMetadata

func InsertMetadata(file *File) (int, error)

func Snapshot

func Snapshot(vaultID string) error

Sets the newest files to also be snapshots and deletes all files which are not snapshots deletes all files where size is not 0 but data is null

Types

type File

type File struct {
	UID        int    `json:"uid" gorm:"primary_key;autoIncrement"`
	VaultID    string `json:"vault_id"`
	Hash       string `json:"hash"`
	Path       string `json:"path"`
	Extension  string `json:"extension"`
	Size       int64  `json:"size"`
	Created    int64  `json:"created"`
	Modified   int64  `json:"modified"`
	Folder     bool   `json:"folder"`
	Deleted    bool   `json:"deleted"`
	Data       []byte `json:"-"`
	Newest     bool   `json:"newest" gorm:"default:true"`
	IsSnapshot bool   `json:"is_snapshot" gorm:"default:false"`
}

func GetFile

func GetFile(uid int) (*File, error)

func GetVaultFiles

func GetVaultFiles(vaultID string) ([]*File, error)

type FileResponse

type FileResponse struct {
	File
	OP string `json:"op"`
}

func RestoreFile

func RestoreFile(uid int) (*FileResponse, error)

type HistoryFile added in v0.1.6

type HistoryFile struct {
	File
	TS int64 `json:"ts"`
}

func GetFileHistory

func GetFileHistory(path string) ([]*HistoryFile, error)

Jump to

Keyboard shortcuts

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