Documentation ¶
Overview ¶
Package db provides access to local database and gives some shortcuts for getting certain types of objects The ultimate goal is to create an abstraction layer for data access so an underlying database structure change does not require to change the entire codebase
Index ¶
- Variables
- func GetDownloadedEpisodes() ([]Episode, error)
- func GetDownloadedMovies() ([]Movie, error)
- func GetDownloadingEpisodes() ([]Episode, error)
- func GetDownloadingMovies() ([]Movie, error)
- func GetNotifications() ([]Notification, error)
- func GetReadNotifications() ([]Notification, error)
- func GetRemovedMovies() ([]Movie, error)
- func GetRemovedTvShows() ([]TvShow, error)
- func GetTrackedMovies() ([]Movie, error)
- func GetTrackedTvShows() ([]TvShow, error)
- func GetUnreadNotifications() ([]Notification, error)
- func InitDb()
- func Load() error
- func ResetDb()
- func SaveDownloadable(d *downloadable.Downloadable)
- func SaveTelegramChatID(chat_id int64)
- func SaveTraktToken(token string)
Constants ¶
This section is empty.
Variables ¶
var Client *gorm.DB
Client represents gorm database connection
var DbFatal func(code int) = os.Exit
var DbPath = DB_PATH
DbPath: Path of database file
var Session SessionData
Current session data
Functions ¶
func GetDownloadedEpisodes ¶
func GetDownloadedEpisodes() ([]Episode, error)
Gets downloaded episodes from database
func GetDownloadedMovies ¶
func GetDownloadedMovies() ([]Movie, error)
Gets downloaded movies from database
func GetDownloadingEpisodes ¶
func GetDownloadingEpisodes() ([]Episode, error)
Gets downloading (or download pending) episodes from database Deleted episodes are returned too. Returned episodes are ordered by id (descending)
func GetDownloadingMovies ¶
func GetDownloadingMovies() ([]Movie, error)
Gets downloading movies from database Returned episodes are ordered by id (descending)
func GetNotifications ¶
func GetNotifications() ([]Notification, error)
func GetReadNotifications ¶
func GetReadNotifications() ([]Notification, error)
func GetRemovedTvShows ¶
func GetRemovedTvShows() ([]TvShow, error)
Gets removed movies from database
func GetTrackedMovies ¶
func GetTrackedMovies() ([]Movie, error)
Returns tracked movies, and an error. Tracked movies are movies retrieved from watchlists that are not already downloaded or currently downloading Most recent tracked movies are returned first A non nil error is returned if a problem was encoutered when getting movies from the database.
func GetTrackedTvShows ¶
func GetTrackedTvShows() ([]TvShow, error)
Returns tracked shows, and an error. Tracked shows are shows added from watchlists that have been retrieved from the local database? Returned shows are ordered by status and title A non nil error is returned if a problem was encoutered when getting shows from the database.
func GetUnreadNotifications ¶
func GetUnreadNotifications() ([]Notification, error)
func SaveDownloadable ¶
func SaveDownloadable(d *downloadable.Downloadable)
func SaveTelegramChatID ¶
func SaveTelegramChatID(chat_id int64)
Saves given token as Trakt token in database
func SaveTraktToken ¶
func SaveTraktToken(token string)
Saves given token as Trakt token in database
Types ¶
This section is empty.