Documentation ¶
Index ¶
- func Connection(c *m.Config) string
- type DB
- func (d *DB) DefaultSettings() m.Settings
- func (d *DB) DeleteEntry(hash string)
- func (d *DB) FileInDatabase(hash, contentType string) bool
- func (d *DB) GetBrowseMovies(media *[]m.Media)
- func (d *DB) GetBrowseShows(media *[]m.Media)
- func (d *DB) GetHomeMedia(media *[]m.Media)
- func (d *DB) GetMedia(media *m.Media, hash string)
- func (d *DB) GetMedias(media *[]m.Media, p [2]int)
- func (d *DB) GetMovie(media *m.Media, hash string)
- func (d *DB) GetMovieDetail(media *m.Media, hash string)
- func (d *DB) GetMovies(media *[]m.Media, p [2]int)
- func (d *DB) GetShow(media *m.Media, hash string)
- func (d *DB) GetShowDetail(media *m.Media, hash string)
- func (d *DB) GetShows(media *[]m.Media, p [2]int)
- func (d *DB) GetWatchedMedia(w *[]m.Media)
- func (d *DB) Init(c *m.Config)
- func (d *DB) LoadSettings() m.Settings
- func (d *DB) PurgeCache()
- func (d *DB) PurgeCacheEntries(keys ...string)
- func (d *DB) PurgeCacheEntry(key string)
- func (d *DB) Reactivate(hash string)
- func (d *DB) SaveEntry(result *m.Result)
- func (d *DB) SoftDeleted(hash string) bool
- func (d *DB) UpdateMovedEntry(hash, path, oldPath string)
- type QueryCacheEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connection ¶
Connection creates the connection string and returns it.
Types ¶
type DB ¶
type DB struct { Conn *gorm.DB Cache map[string]QueryCacheEntry // contains filtered or unexported fields }
DB is the top-level DB interface
func (*DB) DefaultSettings ¶
DefaultSettings saves the default setting to the database, if there isn't a setting already
func (*DB) DeleteEntry ¶
DeleteEntry deletes the entry identified by the provided hash
func (*DB) FileInDatabase ¶
FileInDatabase checks if the file is already indexed and saved in the database
func (*DB) GetBrowseMovies ¶
GetBrowseMovies returns the first 25 movie entries from the database
func (*DB) GetBrowseShows ¶
GetBrowseShows returns the first 25 show entries from the database
func (*DB) GetHomeMedia ¶
GetHomeMedia returns the first 25 media entries from the database
func (*DB) GetMedia ¶
GetMedia returns the first media entry with the matching hash from the database
func (*DB) GetMovie ¶
GetMovie returns the media entry (movie) with the matching hash from the database
func (*DB) GetMovieDetail ¶
GetMovieDetail returns the full movie details by hash from the database
func (*DB) GetShow ¶
GetShow returns the media entry (show) with the matching hash from the database
func (*DB) GetShowDetail ¶
GetShowDetail returns the full show details by hash from the database
func (*DB) GetWatchedMedia ¶
GetWatchedMedia returns the currently watched media entries from the database
func (*DB) Init ¶
Init sets up the database connection, sets table options, auto migrates models and initiates the query cache and will panic if it fails to connect
func (*DB) LoadSettings ¶
LoadSettings loads the lastest setting entry out of the database
func (*DB) PurgeCache ¶
func (d *DB) PurgeCache()
func (*DB) PurgeCacheEntries ¶
func (*DB) PurgeCacheEntry ¶
func (*DB) Reactivate ¶
func (*DB) SoftDeleted ¶
SoftDeleted checks if the entry indentified by the provided hash is soft deleted
func (*DB) UpdateMovedEntry ¶
UpdateMovedEntry updates the source path of the entry identified by the provided hash
type QueryCacheEntry ¶
QueryCacheEntry describes a db query cache entry
func (QueryCacheEntry) IsStale ¶
func (e QueryCacheEntry) IsStale() bool
IsStale returns wether the QueryCacheEntry is stale. A QueryCacheEntry is stale after 60 minutes