file

package
v0.0.3-beta Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

func NewRepository

func NewRepository(db *sql.DB, log contracts.Logger) Repository

func (*Repository) CleanUpDatabase

func (fr *Repository) CleanUpDatabase() (err error)

CleanUpDatabase cleans database from trashed files

func (Repository) CreateFile

func (fr Repository) CreateFile(file *drive.File) error

CreateFile creates a file. It means either it is a new file or it is the first launch of the application. Anyway, the fields prev_remote_modification_time and cur_remote_modification_time are the same.

func (*Repository) Delete

func (fr *Repository) Delete(fileId string) (err error)

func (*Repository) GetCurFilesListByParent

func (fr *Repository) GetCurFilesListByParent(parentId string) ([]contracts.File, error)

func (*Repository) GetFileByHash

func (fr *Repository) GetFileByHash(hash string) (contracts.File, error)

GetFileByHash gets a file by its hash.

func (*Repository) GetFileById

func (fr *Repository) GetFileById(id string) (contracts.File, error)

GetFileById gets a file by its id.

func (*Repository) GetFileIdByCurPath

func (fr *Repository) GetFileIdByCurPath(fullPath string, startWithFolder contracts.File) (string, error)

GetFileIdByCurPath gets file's id by its path.

func (*Repository) GetFileIdByPathSlice

func (fr *Repository) GetFileIdByPathSlice(lookForPath []string, lookInParentId string) (string, error)

GetFileIdByCurPath gets file's id by its path and name.

func (*Repository) GetFileParentFolderPath

func (fr *Repository) GetFileParentFolderPath(id string) (curPath string, prevPath string, err error)

GetFileParentFolderPath gets the path to the parent folder of the file with the provided id

func (*Repository) GetFileParentIdByCurPath

func (fr *Repository) GetFileParentIdByCurPath(fullPath string, startWithFolder contracts.File) (string, error)

GetFileParentIdByCurPath gets file's parent id by its path

func (*Repository) GetLocallyRemovedFoldersIds

func (fr *Repository) GetLocallyRemovedFoldersIds() ([]string, error)

func (*Repository) GetParentIdByChildId

func (fr *Repository) GetParentIdByChildId(childId string) (string, error)

func (*Repository) GetRootFolder

func (fr *Repository) GetRootFolder() (contracts.File, error)

getRootFolder gets the root folder. As in google drive as in Linux everything is a file, we return a file.

func (*Repository) HasTrashedParent

func (fr *Repository) HasTrashedParent(id string) (bool, error)

HasTrashedParent determines if there is a trashed parent.

func (Repository) SaveRootFolder

func (fr Repository) SaveRootFolder(file *drive.File) error

func (*Repository) SetCurRemoteData

func (fr *Repository) SetCurRemoteData(fileId string, mtime string, name string, parents []string) error

SetCurRemoteData updates cur_remote_modification_time and other data so that after we could check if it was changed remotely. mtime is in RFC3339Nano format

func (*Repository) SetDownloadTime

func (fr *Repository) SetDownloadTime(fileId string, date time.Time) (err error)

SetDownloadTime updates download_time so that after we knew if the file was downloaded and if it was changed. download_time equals the last local modification time

func (*Repository) SetPrevRemoteDataToCur

func (fr *Repository) SetPrevRemoteDataToCur(fileId string) error

func (*Repository) SetPrevRemoteModificationDate

func (fr *Repository) SetPrevRemoteModificationDate(fileId string, date time.Time) (err error)

func (*Repository) SetRemovedLocally

func (fr *Repository) SetRemovedLocally(fileId string, removed bool) (err error)

func (*Repository) SetRemovedRemotely

func (fr *Repository) SetRemovedRemotely(fileId string) (err error)

Jump to

Keyboard shortcuts

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