storage

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: BSD-3-Clause, GPL-3.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAt

func CreateAt(path string) error

Types

type AbsolutePathResolutionError

type AbsolutePathResolutionError struct {
	Path   string
	Reason error
}

func (AbsolutePathResolutionError) Error

func (err AbsolutePathResolutionError) Error() string

type FileTagDoesNotExist

type FileTagDoesNotExist struct {
	FileId  entities.FileId
	TagId   entities.TagId
	ValueId entities.ValueId
}

func (FileTagDoesNotExist) Error

func (err FileTagDoesNotExist) Error() string

type Storage

type Storage struct {
	DbPath   string
	RootPath string
	// contains filtered or unexported fields
}

func OpenAt

func OpenAt(path string) (*Storage, error)

func (*Storage) AddFile

func (store *Storage) AddFile(tx *Tx, path string, fingerprint fingerprint.Fingerprint, modTime time.Time, size int64, isDir bool) (*entities.File, error)

Adds a file to the database.

func (*Storage) AddFileTag

func (storage *Storage) AddFileTag(tx *Tx, fileId entities.FileId, tagId entities.TagId, valueId entities.ValueId) (*entities.FileTag, error)

Adds a file tag.

func (Storage) AddImplication

func (storage Storage) AddImplication(tx *Tx, pair, impliedPair entities.TagIdValueIdPair) error

Adds the specified implication.

func (*Storage) AddQuery

func (storage *Storage) AddQuery(tx *Tx, text string) (*entities.Query, error)

Adds a query to the database.

func (*Storage) AddTag

func (storage *Storage) AddTag(tx *Tx, name string) (*entities.Tag, error)

Adds a tag.

func (*Storage) AddValue

func (storage *Storage) AddValue(tx *Tx, name string) (*entities.Value, error)

Adds a value.

func (*Storage) Begin

func (storage *Storage) Begin() (*Tx, error)

func (*Storage) Close

func (storage *Storage) Close() error

func (*Storage) CopyFileTags

func (storage *Storage) CopyFileTags(tx *Tx, sourceTagId, destTagId entities.TagId) error

Copies file tags from one tag to another.

func (Storage) CopyTag

func (storage Storage) CopyTag(tx *Tx, sourceTagId entities.TagId, name string) (*entities.Tag, error)

Copies a tag.

func (*Storage) DeleteFile

func (store *Storage) DeleteFile(tx *Tx, fileId entities.FileId) error

Deletes a file from the database.

func (*Storage) DeleteFileIfUntagged

func (store *Storage) DeleteFileIfUntagged(tx *Tx, fileId entities.FileId) error

Deletes a file if it is untagged

func (*Storage) DeleteFileTag

func (storage *Storage) DeleteFileTag(tx *Tx, fileId entities.FileId, tagId entities.TagId, valueId entities.ValueId) error

Delete file tag.

func (*Storage) DeleteFileTagsByFileId

func (storage *Storage) DeleteFileTagsByFileId(tx *Tx, fileId entities.FileId) error

Deletes all of the file tags for the specified file.

func (*Storage) DeleteFileTagsByTagId

func (storage *Storage) DeleteFileTagsByTagId(tx *Tx, tagId entities.TagId) error

Deletes all of the file tags for the specified tag.

func (*Storage) DeleteFileTagsByValueId

func (storage *Storage) DeleteFileTagsByValueId(tx *Tx, valueId entities.ValueId) error

Deletes all of the file tags for the specified value.

func (Storage) DeleteImplication

func (storage Storage) DeleteImplication(tx *Tx, pair, impliedPair entities.TagIdValueIdPair) error

Deletes the specified implication

func (Storage) DeleteImplicationsByTagId

func (storage Storage) DeleteImplicationsByTagId(tx *Tx, tagId entities.TagId) error

Deletes implications for the specified tag.

func (Storage) DeleteImplicationsByValueId

func (storage Storage) DeleteImplicationsByValueId(tx *Tx, valueId entities.ValueId) error

Deletes implications for the specified value.

func (*Storage) DeleteQuery

func (storage *Storage) DeleteQuery(tx *Tx, text string) error

Removes a query from the database.

func (Storage) DeleteTag

func (storage Storage) DeleteTag(tx *Tx, tagId entities.TagId) error

Deletes a tag.

func (*Storage) DeleteUntaggedFiles

func (store *Storage) DeleteUntaggedFiles(tx *Tx, fileIds entities.FileIds) error

Deletes the specified files if they are untagged

func (*Storage) DeleteValue

func (storage *Storage) DeleteValue(tx *Tx, valueId entities.ValueId) error

Deletes a value.

func (*Storage) DuplicateFiles

func (store *Storage) DuplicateFiles(tx *Tx) ([]entities.Files, error)

Retrieves the sets of duplicate files within the database.

func (*Storage) File

func (store *Storage) File(tx *Tx, id entities.FileId) (*entities.File, error)

Retrieves a specific file.

func (*Storage) FileByPath

func (store *Storage) FileByPath(tx *Tx, path string) (*entities.File, error)

Retrieves the file with the specified path.

func (*Storage) FileCount

func (store *Storage) FileCount(tx *Tx) (uint, error)

Retrieves the total number of tracked files.

func (*Storage) FileCountByFingerprint

func (store *Storage) FileCountByFingerprint(tx *Tx, fingerprint fingerprint.Fingerprint) (uint, error)

Retrieves the number of files with the specified fingerprint.

func (*Storage) FileCountForQuery

func (store *Storage) FileCountForQuery(tx *Tx, expression query.Expression, path string, explicitOnly, ignoreCase bool) (uint, error)

Retrieves the count of files that match the specified query and matching the specified path.

func (*Storage) FileTagCount

func (storage *Storage) FileTagCount(tx *Tx) (uint, error)

Retrieves the total count of file tags in the database.

func (*Storage) FileTagCountByFileId

func (storage *Storage) FileTagCountByFileId(tx *Tx, fileId entities.FileId, explicitOnly bool) (uint, error)

Retrieves the count of file tags for the specified file.

func (*Storage) FileTagCountByTagId

func (storage *Storage) FileTagCountByTagId(tx *Tx, tagId entities.TagId, explicitOnly bool) (uint, error)

Retrieves the count of file tags for the specified tag.

func (*Storage) FileTagCountByValueId

func (storage *Storage) FileTagCountByValueId(tx *Tx, valueId entities.ValueId) (uint, error)

Retrieves the count of file tags for the specified value.

func (*Storage) FileTagExists

func (storage *Storage) FileTagExists(tx *Tx, fileId entities.FileId, tagId entities.TagId, valueId entities.ValueId, explicitOnly bool) (bool, error)

Determines whether the specified file has the specified tag applied.

func (*Storage) FileTags

func (storage *Storage) FileTags(tx *Tx) (entities.FileTags, error)

Retrieves the complete set of file tags.

func (*Storage) FileTagsByFileId

func (storage *Storage) FileTagsByFileId(tx *Tx, fileId entities.FileId, explicitOnly bool) (entities.FileTags, error)

Retrieves the file tags for the specified file ID.

func (*Storage) FileTagsByTagId

func (storage *Storage) FileTagsByTagId(tx *Tx, tagId entities.TagId, explicitOnly bool) (entities.FileTags, error)

Retrieves the file tags with the specified tag ID.

func (*Storage) FileTagsByValueId

func (storage *Storage) FileTagsByValueId(tx *Tx, valueId entities.ValueId) (entities.FileTags, error)

Retrieves the file tags with the specified value ID.

func (*Storage) Files

func (store *Storage) Files(tx *Tx, sort string) (entities.Files, error)

The complete set of tracked files.

func (*Storage) FilesByDirectories

func (store *Storage) FilesByDirectories(tx *Tx, paths []string) (entities.Files, error)

Retrieves all file that are under the specified directories.

func (*Storage) FilesByDirectory

func (store *Storage) FilesByDirectory(tx *Tx, path string) (entities.Files, error)

Retrieves all files that are under the specified directory.

func (*Storage) FilesByFingerprint

func (store *Storage) FilesByFingerprint(tx *Tx, fingerprint fingerprint.Fingerprint) (entities.Files, error)

Retrieves the set of files with the specified fingerprint.

func (*Storage) FilesForQuery

func (store *Storage) FilesForQuery(tx *Tx, expression query.Expression, path string, explicitOnly, ignoreCase bool, sort string) (entities.Files, error)

Retrieves the set of files that match the specified query.

func (*Storage) Implications

func (storage *Storage) Implications(tx *Tx) (entities.Implications, error)

Retrieves the complete set of tag implications.

func (*Storage) ImplicationsFor

func (storage *Storage) ImplicationsFor(tx *Tx, pairs ...entities.TagIdValueIdPair) (entities.Implications, error)

Retrieves the set of implications for the specified tag and value pairs.

func (*Storage) ImplicationsImplying

func (storage *Storage) ImplicationsImplying(tx *Tx, pairs ...entities.TagIdValueIdPair) (entities.Implications, error)

Retrieves the set of implications that imply the specified tag and value pairs.

func (*Storage) Queries

func (storage *Storage) Queries(tx *Tx) (entities.Queries, error)

The complete set of queries.

func (*Storage) Query

func (storage *Storage) Query(tx *Tx, text string) (*entities.Query, error)

Retrievs the specified query.

func (Storage) RenameTag

func (storage Storage) RenameTag(tx *Tx, tagId entities.TagId, name string) (*entities.Tag, error)

Renames a tag.

func (*Storage) RenameValue

func (storage *Storage) RenameValue(tx *Tx, valueId entities.ValueId, newName string) (*entities.Value, error)

Renames a value.

func (*Storage) Setting

func (storage *Storage) Setting(tx *Tx, name string) (*entities.Setting, error)

func (*Storage) Settings

func (storage *Storage) Settings(tx *Tx) (entities.Settings, error)

The complete set of settings.

func (Storage) Tag

func (storage Storage) Tag(tx *Tx, id entities.TagId) (*entities.Tag, error)

Retrieves a specific tag.

func (Storage) TagByCasedName

func (storage Storage) TagByCasedName(tx *Tx, name string, ignoreCase bool) (*entities.Tag, error)

Retrieves a specific tag with specified case-sensitivity.

func (Storage) TagByName

func (storage Storage) TagByName(tx *Tx, name string) (*entities.Tag, error)

Retrieves a specific tag.

func (*Storage) TagCount

func (storage *Storage) TagCount(tx *Tx) (uint, error)

The number of tags in the database.

func (Storage) TagUsage

func (storage Storage) TagUsage(tx *Tx) ([]entities.TagFileCount, error)

Retrieves the tag usage.

func (*Storage) Tags

func (storage *Storage) Tags(tx *Tx) (entities.Tags, error)

The set of tags.

func (Storage) TagsByCasedNames

func (storage Storage) TagsByCasedNames(tx *Tx, names []string, ignoreCase bool) (entities.Tags, error)

Retrieves the set of named tags.

func (Storage) TagsByIds

func (storage Storage) TagsByIds(tx *Tx, ids entities.TagIds) (entities.Tags, error)

Retrieves a specific set of tags.

func (Storage) TagsByNames

func (storage Storage) TagsByNames(tx *Tx, names []string) (entities.Tags, error)

Retrieves the set of named tags.

func (*Storage) UntaggedFiles

func (store *Storage) UntaggedFiles(tx *Tx) (entities.Files, error)

Retrieves the set of untagged files.

func (*Storage) UnusedValues

func (storage *Storage) UnusedValues(tx *Tx) (entities.Values, error)

Retrieves the set of unused values.

func (*Storage) UpdateFile

func (store *Storage) UpdateFile(tx *Tx, fileId entities.FileId, path string, fingerprint fingerprint.Fingerprint, modTime time.Time, size int64, isDir bool) (*entities.File, error)

Updates a file in the database.

func (*Storage) UpdateSetting

func (storage *Storage) UpdateSetting(tx *Tx, name, value string) (*entities.Setting, error)

func (*Storage) Value

func (storage *Storage) Value(tx *Tx, id entities.ValueId) (*entities.Value, error)

Retrieves a specific value.

func (*Storage) ValueByCasedName

func (storage *Storage) ValueByCasedName(tx *Tx, name string, ignoreCase bool) (*entities.Value, error)

Retrieves a specific value by name.

func (*Storage) ValueByName

func (storage *Storage) ValueByName(tx *Tx, name string) (*entities.Value, error)

Retrieves a specific value by name.

func (*Storage) ValueCount

func (storage *Storage) ValueCount(tx *Tx) (uint, error)

Retrievse the count of values.

func (*Storage) Values

func (storage *Storage) Values(tx *Tx) (entities.Values, error)

Retrieves the complete set of values.

func (*Storage) ValuesByCasedNames

func (storage *Storage) ValuesByCasedNames(tx *Tx, names []string, ignoreCase bool) (entities.Values, error)

Retrieves the set of values with the specified names.

func (Storage) ValuesByIds

func (storage Storage) ValuesByIds(tx *Tx, ids entities.ValueIds) (entities.Values, error)

Retrieves a specific set of values.

func (*Storage) ValuesByNames

func (storage *Storage) ValuesByNames(tx *Tx, names []string) (entities.Values, error)

Retrieves the set of values with the specified names.

func (*Storage) ValuesByTag

func (storage *Storage) ValuesByTag(tx *Tx, tagId entities.TagId) (entities.Values, error)

Retrieves the set of values for the specified tag.

type Tx

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

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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