torrents

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 16 Imported by: 56

Documentation

Index

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 Create

func Create(user *models.User, uploadForm *torrentValidator.TorrentRequest) (*models.Torrent, error)

func ExistOrDelete

func ExistOrDelete(hash string, user *models.User) error

ExistOrDelete : Check if a torrent exist with the same hash and if it can be replaced, it is replaced

func Find

func Find(parameters structs.WhereParams, limit int, offset int) ([]models.Torrent, int, error)

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 FindAll

func FindAll(limit int, offset int) ([]models.Torrent, int, error)

FindAll : Get all torrents without order

func FindAllOrderBy

func FindAllOrderBy(orderBy string, limit int, offset int) ([]models.Torrent, int, error)

FindAllOrderBy : Get all torrents ordered by parameters

func FindByID

func FindByID(id uint) (*models.Torrent, error)

FindByID : get a torrent with its id

func FindDB

func FindDB(parameters structs.WhereParams) ([]models.Torrent, int, error)

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

func FindRawByHash(hash string) (torrent models.Torrent, err error)

FindRawByHash : Get torrent with id without user or comments won't fetch user or comments

func FindRawByID

func FindRawByID(id uint) (torrent models.Torrent, err error)

FindRawByID : Get torrent with id without user or comments won't fetch user or comments

func FindUnscopeByID

func FindUnscopeByID(id uint) (torrent models.Torrent, err error)

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 GetAllInDB

func GetAllInDB() ([]models.Torrent, int, error)

GetAllInDB : Get all torrents

func HideUser

func HideUser(uploaderID uint, uploaderName string, torrentHidden bool) (uint, string)

HideUser : hides a torrent user for hidden torrents

func NewTorrentEvent

func NewTorrentEvent(user *models.User, torrent *models.Torrent) error

NewTorrentEvent : Should be called when you create a new torrent

func ToggleBlock

func ToggleBlock(id uint) (models.Torrent, int, error)

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.

Jump to

Keyboard shortcuts

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