Documentation
¶
Index ¶
- type Audio
- type AudioFilter
- type DB
- func (db DB) AddAudio(audio *Audio) error
- func (db DB) AddDocument(doc *Document) error
- func (db DB) AddFile(file *File) error
- func (db DB) AddPicture(pic *Picture) error
- func (db DB) AddVideo(vid *Video) error
- func (db DB) AllFileCount() (int, error)
- func (db DB) AllFileInfosAt(path string) (map[string]ShortFileInfo, error)
- func (db *DB) BeginTx() error
- func (db *DB) Commit() error
- func (db DB) DeletePaths(paths []string) error
- func (db DB) PrintAllDetails() error
- func (db DB) PrintAllPaths(filter FileFilter) error
- func (db DB) PrintAudiosDetails() error
- func (db DB) PrintAudiosPaths(filter AudioFilter) error
- func (db DB) PrintDocumentsDetails() error
- func (db DB) PrintDocumentsPaths(filter DocumentFilter) error
- func (db DB) PrintOthersDetails() error
- func (db DB) PrintOthersPaths(filter FileFilter) error
- func (db DB) PrintPicturesDetails() error
- func (db DB) PrintPicturesPaths(filter PictureFilter) error
- func (db DB) PrintVideosDetails() error
- func (db DB) PrintVideosPaths(filter VideoFilter) error
- func (db *DB) Rollback() error
- func (db *DB) TrackPath(path string) error
- func (db *DB) TrackedPaths() ([]string, error)
- func (db *DB) UntrackPath(path string) error
- type Document
- type DocumentFilter
- type File
- type FileFilter
- type Picture
- type PictureFilter
- type ShortFileInfo
- type Video
- type VideoFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioFilter ¶
type AudioFilter struct {
FileFilter
MinDuration, MaxDuration *time.Duration
Author string
MinYear, MaxYear *int
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a database connection. It is not safe for asynchronous write accesses. Use the BeginTx, Commit, Rollback and Add* Methods in series only.
func NewDB ¶
NewDB creates a new database by initializing or updating the schema and returns the ready to use database.
func (DB) AddAudio ¶
AddAudio adds an audio file to the database. If the audio already exists, nothing will be done. db.BeginTx must have been called before.
func (DB) AddDocument ¶
AddDocument adds a document to the database. If the document already exists, nothing will be done. db.BeginTx must have been called before.
func (DB) AddFile ¶
AddFile adds an unspecific file to the database. If the file already exists, nothing will be done. db.BeginTx must have been called before.
func (DB) AddPicture ¶
AddPicture adds a picture to the database. If the picture already exists, nothing will be done. db.BeginTx must have been called before.
func (DB) AddVideo ¶
AddVideo adds a picture to the database. If the video already exists, nothing will be done. db.BeginTx must have been called before.
func (DB) AllFileCount ¶
func (DB) AllFileInfosAt ¶
func (db DB) AllFileInfosAt(path string) (map[string]ShortFileInfo, error)
AllFileInfosAt returns a map with paths as keys, containing all stored paths below the given path with file info.
db.Begin must have been called to create a transaction before calling AllFileInfosAt.
func (*DB) BeginTx ¶
BeginTx starts a transaction. It must be called before writing to the database. If a transaction is already in progress, BeginTx will block until a transaction can be started.
Do not use when just reading from the database.
It is the callers responsibility to call db.Commit or db.Rollback the end the transaction.
func (DB) DeletePaths ¶
DeletePaths deletes all file entries for the given paths.
db.Begin must have been called to create a transaction before calling DeletePaths.
func (DB) PrintAllDetails ¶
func (DB) PrintAllPaths ¶
func (db DB) PrintAllPaths(filter FileFilter) error
func (DB) PrintAudiosDetails ¶
func (DB) PrintAudiosPaths ¶
func (db DB) PrintAudiosPaths(filter AudioFilter) error
func (DB) PrintDocumentsDetails ¶
func (DB) PrintDocumentsPaths ¶
func (db DB) PrintDocumentsPaths(filter DocumentFilter) error
func (DB) PrintOthersDetails ¶
func (DB) PrintOthersPaths ¶
func (db DB) PrintOthersPaths(filter FileFilter) error
func (DB) PrintPicturesDetails ¶
func (DB) PrintPicturesPaths ¶
func (db DB) PrintPicturesPaths(filter PictureFilter) error
func (DB) PrintVideosDetails ¶
func (DB) PrintVideosPaths ¶
func (db DB) PrintVideosPaths(filter VideoFilter) error
func (*DB) TrackPath ¶
TrackPath adds a path to be tracked. It will return an error if the path is already tracked.
func (*DB) TrackedPaths ¶
TrackedPaths returns a list of all tracked paths.
func (*DB) UntrackPath ¶
UntrackPath removes the given path from the tracked paths. It also removes all file entries that existed only because of this path.
type DocumentFilter ¶
type DocumentFilter struct {
FileFilter
TxtOnly bool
}
type FileFilter ¶
type PictureFilter ¶
type PictureFilter struct {
FileFilter
Camera string
}
type ShortFileInfo ¶
type VideoFilter ¶
type VideoFilter struct {
FileFilter
MinDuration, MaxDuration *time.Duration
Camera string
MinYear, MaxYear *int
}