Documentation ¶
Index ¶
- func APITorrentsToJSON(t []models.Torrent) []models.TorrentJSON
- func Create(user *models.User, uploadForm *torrentValidator.TorrentRequest) (*models.Torrent, error)
- func ExistOrDelete(hash string, user *models.User) error
- func Find(parameters structs.WhereParams, limit int, offset int) ([]models.Torrent, int, error)
- func FindAll(limit int, offset int) ([]models.Torrent, int, error)
- func FindAllOrderBy(orderBy string, limit int, offset int) ([]models.Torrent, int, error)
- func FindByID(id uint) (*models.Torrent, error)
- func FindDB(parameters structs.WhereParams) ([]models.Torrent, int, error)
- func FindDeleted(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
- func FindOrderBy(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
- func FindOrderByNoCount(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, err error)
- func FindRawByHash(hash string) (torrent models.Torrent, err error)
- func FindRawByID(id uint) (torrent models.Torrent, err error)
- func FindUnscopeByID(id uint) (torrent models.Torrent, err error)
- func FindWithUserOrderBy(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
- func GetAllInDB() ([]models.Torrent, int, error)
- func HideUser(uploaderID uint, uploaderName string, torrentHidden bool) (uint, string)
- func NewTorrentEvent(user *models.User, torrent *models.Torrent) error
- func ToggleBlock(id uint) (models.Torrent, int, error)
- func TorrentsToAPI(t []models.Torrent) []models.TorrentJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APITorrentsToJSON ¶
func APITorrentsToJSON(t []models.Torrent) []models.TorrentJSON
APITorrentsToJSON : Map Torrents to TorrentsToJSON for API request without reallocations
func ExistOrDelete ¶
ExistOrDelete : Check if a torrent exist with the same hash and if it can be replaced, it is replaced
func Find ¶
Find obtain a list of torrents matching 'parameters' from the database. The list will be of length 'limit' and in default order. GetTorrents returns the first records found. Later records may be retrieved by providing a positive 'offset'
func FindAllOrderBy ¶
FindAllOrderBy : Get all torrents ordered by parameters
func FindDB ¶
FindDB : Get Torrents with where parameters but no limit and order by default (get all the torrents corresponding in the db)
func FindDeleted ¶
func FindDeleted(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
FindDeleted : Gets deleted torrents based on search params
func FindOrderBy ¶
func FindOrderBy(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
FindOrderBy : Get torrents based on search without user
func FindOrderByNoCount ¶
func FindOrderByNoCount(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, err error)
FindOrderByNoCount : Get torrents based on search without counting and user
func FindRawByHash ¶
FindRawByHash : Get torrent with id without user or comments won't fetch user or comments
func FindRawByID ¶
FindRawByID : Get torrent with id without user or comments won't fetch user or comments
func FindUnscopeByID ¶
FindUnscopeByID : Get torrent with ID deleted or not
func FindWithUserOrderBy ¶
func FindWithUserOrderBy(parameters *structs.WhereParams, orderBy string, limit int, offset int) (torrents []models.Torrent, count int, err error)
FindWithUserOrderBy : Get torrents based on search with user
func NewTorrentEvent ¶
NewTorrentEvent : Should be called when you create a new torrent
func ToggleBlock ¶
ToggleBlock ; Lock/Unlock a torrent based on id
func TorrentsToAPI ¶
func TorrentsToAPI(t []models.Torrent) []models.TorrentJSON
TorrentsToAPI : Map Torrents for API usage without reallocations
Types ¶
This section is empty.