database

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2014 License: BSD-3-Clause, GPL-3.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Path string

Functions

This section is empty.

Types

type Database

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

func Open

func Open() (*Database, error)

Opens the database

func OpenAt

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

Opens the database at the specified path

func (*Database) AddFileTag

func (db *Database) AddFileTag(fileId, tagId, valueId uint) (*entities.FileTag, error)

Adds a file tag.

func (Database) AddImplication added in v0.2.0

func (db Database) AddImplication(tagId, impliedTagId uint) error

Adds the specified implications

func (*Database) Begin added in v0.4.0

func (db *Database) Begin() error

Start a transaction

func (*Database) Close

func (db *Database) Close() error

Closes the database connection

func (*Database) Commit added in v0.4.0

func (db *Database) Commit() error

Commits the current transaction

func (*Database) CopyFileTags

func (db *Database) CopyFileTags(sourceTagId uint, destTagId uint) error

Copies file tags from one tag to another.

func (*Database) CreateFileTable added in v0.4.0

func (db *Database) CreateFileTable() error

func (*Database) CreateFileTagTable added in v0.4.0

func (db *Database) CreateFileTagTable() error

func (*Database) CreateImplicationTable added in v0.4.0

func (db *Database) CreateImplicationTable() error

func (*Database) CreateQueryTable added in v0.4.0

func (db *Database) CreateQueryTable() error

func (*Database) CreateSchema

func (db *Database) CreateSchema() error

func (*Database) CreateSettingTable added in v0.4.0

func (db *Database) CreateSettingTable() error

func (*Database) CreateTagTable added in v0.4.0

func (db *Database) CreateTagTable() error

func (*Database) CreateValueTable added in v0.4.0

func (db *Database) CreateValueTable() error

func (*Database) DeleteFile

func (db *Database) DeleteFile(fileId uint) error

Removes a file from the database.

func (*Database) DeleteFileTag

func (db *Database) DeleteFileTag(fileId, tagId, valueId uint) error

Removes a file tag.

func (*Database) DeleteFileTagsByFileId

func (db *Database) DeleteFileTagsByFileId(fileId uint) error

Removes all of the file tags for the specified file.

func (*Database) DeleteFileTagsByTagId

func (db *Database) DeleteFileTagsByTagId(tagId uint) error

Removes all of the file tags for the specified tag.

func (Database) DeleteImplication added in v0.2.0

func (db Database) DeleteImplication(tagId, impliedTagId uint) error

Deletes the specified implications

func (Database) DeleteImplicationsForTagId added in v0.2.0

func (db Database) DeleteImplicationsForTagId(tagId uint) error

Deletes implications featuring the specified tag.

func (*Database) DeleteQuery added in v0.3.0

func (db *Database) DeleteQuery(text string) error

Removes a query from the database.

func (*Database) DeleteTag

func (db *Database) DeleteTag(tagId uint) error

Deletes a tag.

func (*Database) DeleteUntaggedFiles added in v0.4.0

func (db *Database) DeleteUntaggedFiles() error

Deletes all untagged files.

func (*Database) DeleteUnusedValues added in v0.4.0

func (db *Database) DeleteUnusedValues() error

Deletes all unused values.

func (*Database) DeleteValue added in v0.4.0

func (db *Database) DeleteValue(valueId uint) error

Deletes a value.

func (*Database) DuplicateFiles

func (db *Database) DuplicateFiles() ([]entities.Files, error)

Retrieves the sets of duplicate files within the database.

func (*Database) Exec added in v0.4.0

func (db *Database) Exec(sql string, args ...interface{}) (sql.Result, error)

Executes a SQL query.

func (*Database) ExecQuery added in v0.4.0

func (db *Database) ExecQuery(sql string, args ...interface{}) (*sql.Rows, error)

Executes a SQL query returning rows.

func (*Database) File

func (db *Database) File(id uint) (*entities.File, error)

Retrieves a specific file.

func (*Database) FileByPath

func (db *Database) FileByPath(path string) (*entities.File, error)

Retrieves the file with the specified path.

func (*Database) FileCount

func (db *Database) FileCount() (uint, error)

Retrieves the total number of tracked files.

func (*Database) FileCountByFingerprint

func (db *Database) FileCountByFingerprint(fingerprint fingerprint.Fingerprint) (uint, error)

Retrieves the number of files with the specified fingerprint.

func (*Database) FileTagCount

func (db *Database) FileTagCount() (uint, error)

Retrieves the total count of file tags in the database.

func (*Database) FileTagCountByFileId

func (db *Database) FileTagCountByFileId(fileId uint) (uint, error)

Retrieves the count of file tags for the specified file.

func (*Database) FileTagCountByTagId added in v0.3.0

func (db *Database) FileTagCountByTagId(tagId uint) (uint, error)

Retrieves the count of file tags for the specified tag.

func (*Database) FileTagCountByValueId added in v0.4.0

func (db *Database) FileTagCountByValueId(valueId uint) (uint, error)

Retrieves the count of file tags for the specified value.

func (*Database) FileTagExists

func (db *Database) FileTagExists(fileId, tagId, value_id uint) (bool, error)

Determines whether the specified file has the specified tag applied.

func (*Database) FileTags

func (db *Database) FileTags() (entities.FileTags, error)

Retrieves the complete set of file tags.

func (*Database) FileTagsByFileId

func (db *Database) FileTagsByFileId(fileId uint) (entities.FileTags, error)

Retrieves the set of file tags for the specified file.

func (*Database) FileTagsByTagId

func (db *Database) FileTagsByTagId(tagId uint) (entities.FileTags, error)

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

func (*Database) FileTagsByValueId added in v0.4.0

func (db *Database) FileTagsByValueId(valueId uint) (entities.FileTags, error)

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

func (*Database) Files

func (db *Database) Files() (entities.Files, error)

The complete set of tracked files.

func (*Database) FilesByDirectory

func (db *Database) FilesByDirectory(path string) (entities.Files, error)

Retrieves all files that are under the specified directory.

func (*Database) FilesByFingerprint

func (db *Database) FilesByFingerprint(fingerprint fingerprint.Fingerprint) (entities.Files, error)

Retrieves the set of files with the specified fingerprint.

func (*Database) Implications added in v0.2.0

func (db *Database) Implications() (entities.Implications, error)

Retrieves the complete set of tag implications.

func (*Database) ImplicationsForTags added in v0.2.0

func (db *Database) ImplicationsForTags(tagIds []uint) (entities.Implications, error)

Retrieves the set of tags implied by the specified tags.

func (*Database) InsertFile

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

Adds a file to the database.

func (*Database) InsertQuery added in v0.3.0

func (db *Database) InsertQuery(text string) (*entities.Query, error)

Adds a query to the database.

func (*Database) InsertTag

func (db *Database) InsertTag(name string) (*entities.Tag, error)

Adds a tag.

func (*Database) InsertValue added in v0.4.0

func (db *Database) InsertValue(name string) (*entities.Value, error)

Adds a value.

func (*Database) Queries added in v0.3.0

func (db *Database) Queries() (entities.Queries, error)

The complete set of queries.

func (*Database) Query added in v0.3.0

func (db *Database) Query(text string) (*entities.Query, error)

Retrieves the specified query.

func (*Database) QueryFileCount added in v0.4.0

func (db *Database) QueryFileCount(expression query.Expression, path string) (uint, error)

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

func (*Database) QueryFiles added in v0.3.0

func (db *Database) QueryFiles(expression query.Expression, path string) (entities.Files, error)

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

func (*Database) RenameTag

func (db *Database) RenameTag(tagId uint, name string) (*entities.Tag, error)

Renames a tag.

func (*Database) Rollback added in v0.4.0

func (db *Database) Rollback() error

Rolls back the current transaction

func (*Database) Setting added in v0.4.0

func (db *Database) Setting(name string) (*entities.Setting, error)

Retrieves the specified setting.

func (*Database) Settings added in v0.4.0

func (db *Database) Settings() (entities.Settings, error)

The complete set of settings.

func (*Database) Tag

func (db *Database) Tag(id uint) (*entities.Tag, error)

Retrieves a specific tag.

func (*Database) TagByName

func (db *Database) TagByName(name string) (*entities.Tag, error)

Retrieves a specific tag.

func (*Database) TagCount

func (db *Database) TagCount() (uint, error)

The number of tags in the database.

func (*Database) Tags

func (db *Database) Tags() (entities.Tags, error)

The set of tags.

func (*Database) TagsByIds added in v0.4.0

func (db *Database) TagsByIds(ids []uint) (entities.Tags, error)

Retrieves a specific set of tags.

func (*Database) TagsByNames

func (db *Database) TagsByNames(names []string) (entities.Tags, error)

Retrieves the set of named tags.

func (*Database) TopTags added in v0.3.0

func (db *Database) TopTags(count uint) ([]entities.TagFileCount, error)

Retrieves the most popular tags.

func (*Database) UntaggedFiles added in v0.4.0

func (db *Database) UntaggedFiles() (entities.Files, error)

Retrieves the set of untagged files.

func (*Database) UnusedValues added in v0.4.0

func (db *Database) UnusedValues() (entities.Values, error)

Retrieves the set of unused values.

func (*Database) UpdateFile

func (db *Database) UpdateFile(fileId uint, path string, fingerprint fingerprint.Fingerprint, modTime time.Time, size int64, isDir bool) (*entities.File, error)

Updates a file in the database.

func (Database) UpdateImplicationsForTagId added in v0.2.0

func (db Database) UpdateImplicationsForTagId(implyingTagId, impliedTagId uint) error

Updates implications featuring the specified tag.

func (*Database) Value added in v0.4.0

func (db *Database) Value(id uint) (*entities.Value, error)

Retrieves a specific value.

func (*Database) ValueByName added in v0.4.0

func (db *Database) ValueByName(name string) (*entities.Value, error)

Retrieves a specific value by name.

func (*Database) ValueCount added in v0.4.0

func (db *Database) ValueCount() (uint, error)

Retrieves the count of values.

func (*Database) Values added in v0.4.0

func (db *Database) Values() (entities.Values, error)

Retrieves the complete set of values.

func (*Database) ValuesByIds added in v0.4.1

func (db *Database) ValuesByIds(ids []uint) (entities.Values, error)

Retrieves a specific set of values.

func (*Database) ValuesByNames added in v0.4.0

func (db *Database) ValuesByNames(names []string) (entities.Values, error)

Retrieves the set of values with the specified names.

func (*Database) ValuesByTagId added in v0.4.0

func (db *Database) ValuesByTagId(tagId uint) (entities.Values, error)

Retrieves the set of values for the specified tag.

type SqlBuilder added in v0.3.0

type SqlBuilder struct {
	Sql    string
	Params []interface{}
	// contains filtered or unexported fields
}

func NewBuilder added in v0.3.0

func NewBuilder() SqlBuilder

func (*SqlBuilder) AppendParam added in v0.3.0

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

func (*SqlBuilder) AppendSql added in v0.3.0

func (builder *SqlBuilder) AppendSql(sql string)

Jump to

Keyboard shortcuts

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