db

package
v0.0.0-...-01b0788 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var Client *gorm.DB

Client represents gorm database connection

View Source
var DbFatal func(code int) = os.Exit
View Source
var DbPath = DB_PATH

DbPath: Path of database file

View Source
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 GetRemovedMovies

func GetRemovedMovies() ([]Movie, error)

Gets removed movies from database

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 InitDb

func InitDb()

InitDb initializes and migrates database tables

func Load

func Load() error

Load initializes database connexion

func ResetDb

func ResetDb()

Reset DB tables to an empty state. Mainly used in test suite.

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.

Jump to

Keyboard shortcuts

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