database

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileTag

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

Adds a file tag.

func AddImplication

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

Adds the specified implications

func CopyFileTags

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

Copies file tags from one tag to another.

func CreateAt

func CreateAt(path string) error

func DeleteFile

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

Removes a file from the database.

func DeleteFileTag

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

Removes a file tag.

func DeleteFileTagsByFileId

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

Removes all of the file tags for the specified file.

func DeleteFileTagsByTagId

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

Removes all of the file tags for the specified tag.

func DeleteFileTagsByValueId

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

Removes all of the file tags for the specified value.

func DeleteImplication

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

Deletes the specified implication

func DeleteImplicationsByTagId

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

Deletes implications for the specified tag id

func DeleteImplicationsByValueId

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

Deletes implications for the specified value id

func DeleteQuery

func DeleteQuery(tx *Tx, text string) error

Removes a query from the database.

func DeleteTag

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

Deletes a tag.

func DeleteUntaggedFiles

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

Deletes the specified files if they are untagged

func DeleteValue

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

Deletes a value.

func DuplicateFiles

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

Retrieves the sets of duplicate files within the database.

func File

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

Retrieves a specific file.

func FileByPath

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

Retrieves the file with the specified path.

func FileCount

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

Retrieves the total number of tracked files.

func FileCountByFingerprint

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

Retrieves the number of files with the specified fingerprint.

func FileCountForQuery

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

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

func FileTagCount

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

Retrieves the total count of file tags in the database.

func FileTagCountByFileId

func FileTagCountByFileId(tx *Tx, fileId entities.FileId) (uint, error)

Retrieves the count of file tags for the specified file.

func FileTagCountByTagId

func FileTagCountByTagId(tx *Tx, tagId entities.TagId) (uint, error)

Retrieves the count of file tags for the specified tag.

func FileTagCountByValueId

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

Retrieves the count of file tags for the specified value.

func FileTagExists

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

Determines whether the specified file has the specified tag applied.

func FileTags

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

Retrieves the complete set of file tags.

func FileTagsByFileId

func FileTagsByFileId(tx *Tx, fileId entities.FileId) (entities.FileTags, error)

Retrieves the set of file tags for the specified file.

func FileTagsByTagId

func FileTagsByTagId(tx *Tx, tagId entities.TagId) (entities.FileTags, error)

Retrieves the set of file tags with the specified tag ID.

func FileTagsByValueId

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

Retrieves the set of file tags with the specified value ID.

func Files

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

The complete set of tracked files.

func FilesByDirectory

func FilesByDirectory(tx *Tx, path string, pathContainsRoot bool) (entities.Files, error)

Retrieves all files that are under the specified directory.

func FilesByFingerprint

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

Retrieves the set of files with the specified fingerprint.

func FilesForQuery

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

Retrieves the set of files matching the specified query and matching the specified path.

func Implications

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

Retrieves the complete set of tag implications.

func ImplicationsFor

func ImplicationsFor(tx *Tx, pairs entities.TagIdValueIdPairs) (entities.Implications, error)

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

func ImplyingImplications

func ImplyingImplications(tx *Tx, pairs entities.TagIdValueIdPairs) (entities.Implications, error)

func InsertFile

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

Adds a file to the database.

func InsertQuery

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

Adds a query to the database.

func InsertTag

func InsertTag(tx *Tx, name string) (*entities.Tag, error)

Adds a tag.

func InsertValue

func InsertValue(tx *Tx, name string) (*entities.Value, error)

Adds a value.

func Queries

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

The complete set of queries.

func Query

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

Retrieves the specified query.

func RenameTag

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

Renames a tag.

func RenameValue

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

Renames a value.

func Setting

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

func Settings

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

The complete set of settings.

func Tag

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

Retrieves a specific tag.

func TagByName

func TagByName(tx *Tx, name string, ignoreCase bool) (*entities.Tag, error)

Retrieves a specific tag.

func TagCount

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

The number of tags in the database.

func TagUsage

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

Retrieves the usage of each tag

func Tags

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

The set of tags.

func TagsByIds

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

Retrieves a specific set of tags.

func TagsByNames

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

Retrieves the set of named tags.

func UntaggedFiles

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

Retrieves the set of untagged files.

func UnusedValues

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

Retrieves the set of unused values.

func UpdateFile

func 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 UpdateSetting

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

func Value

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

Retrieves a specific value.

func ValueByName

func ValueByName(tx *Tx, name string, ignoreCase bool) (*entities.Value, error)

Retrieves a specific value by name.

func ValueCount

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

Retrieves the count of values.

func Values

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

Retrieves the complete set of values.

func ValuesByIds

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

Retrieves a specific set of values.

func ValuesByNames

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

Retrieves the set of values with the specified names.

func ValuesByTagId

func ValuesByTagId(tx *Tx, tagId entities.TagId) (entities.Values, error)

Retrieves the set of values for the specified tag.

Types

type Database

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

func OpenAt

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

func (*Database) Begin

func (database *Database) Begin() (*Tx, error)

func (*Database) Close

func (database *Database) Close() error

type DatabaseAccessError

type DatabaseAccessError struct {
	DatabasePath string
	Reason       error
}

func (DatabaseAccessError) Error

func (err DatabaseAccessError) Error() string

type DatabaseNotFoundError

type DatabaseNotFoundError struct {
	Path string
}

func (DatabaseNotFoundError) Error

func (err DatabaseNotFoundError) Error() string

type DatabaseQueryError

type DatabaseQueryError struct {
	DatabasePath string
	Query        string
	Reason       error
}

func (DatabaseQueryError) Error

func (err DatabaseQueryError) Error() string

type DatabaseTransactionError

type DatabaseTransactionError struct {
	DatabasePath string
	Reason       error
}

func (DatabaseTransactionError) Error

func (err DatabaseTransactionError) Error() string

type NoSuchFileError

type NoSuchFileError struct {
	FileId entities.FileId
}

func (NoSuchFileError) Error

func (err NoSuchFileError) Error() string

type NoSuchFileTagError

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

func (NoSuchFileTagError) Error

func (err NoSuchFileTagError) Error() string

type NoSuchImplicationError

type NoSuchImplicationError struct {
	TagValuePair        entities.TagIdValueIdPair
	ImpliedTagValuePair entities.TagIdValueIdPair
}

func (NoSuchImplicationError) Error

func (err NoSuchImplicationError) Error() string

type NoSuchQueryError

type NoSuchQueryError struct {
	Query string
}

func (NoSuchQueryError) Error

func (err NoSuchQueryError) Error() string

type NoSuchSettingError

type NoSuchSettingError struct {
	Name string
}

func (NoSuchSettingError) Error

func (err NoSuchSettingError) Error() string

type NoSuchValueError

type NoSuchValueError struct {
	ValueId entities.ValueId
}

func (NoSuchValueError) Error

func (err NoSuchValueError) Error() string

type SqlBuilder

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

func NewBuilder

func NewBuilder() *SqlBuilder

func (*SqlBuilder) AppendParam

func (builder *SqlBuilder) AppendParam(value interface{})

func (*SqlBuilder) AppendSql

func (builder *SqlBuilder) AppendSql(sql string)

func (*SqlBuilder) Params

func (builder *SqlBuilder) Params() []interface{}

func (*SqlBuilder) Sql

func (builder *SqlBuilder) Sql() string

type Tx

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

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Exec

func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)

func (*Tx) Query

func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Jump to

Keyboard shortcuts

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