Documentation ¶
Index ¶
- Variables
- type DB
- type Postgres
- func (db *Postgres) AddCategory(name string) (err error)
- func (db *Postgres) AddTorrentTags(tags []model.Tag, t *model.Torrent) (err error)
- func (db *Postgres) AddUserLogin(user, passwd string) (err error)
- func (db *Postgres) CheckLogin(user, passwd string) (authed bool, err error)
- func (db *Postgres) DelCategory(name string) (err error)
- func (db *Postgres) DelTorrent(ih string) (err error)
- func (db *Postgres) DelTorrentTags(tags []model.Tag, t *model.Torrent) (err error)
- func (db *Postgres) DelUserLogin(user string) (err error)
- func (db *Postgres) EnsureTags(tags []string) (ensured []model.Tag, err error)
- func (st *Postgres) FindTorrentByInfohash(ih [20]byte) (t *model.Torrent, err error)
- func (st *Postgres) FindTorrentsInCategory(cat *model.Category, perpage, offset int) (torrents []model.Torrent, err error)
- func (st *Postgres) FindTorrentsWithTag(tag model.Tag) (torrents []model.Torrent, err error)
- func (st *Postgres) GetAllCategories() (cats []model.Category, err error)
- func (st *Postgres) GetCategoryByID(id int) (cat *model.Category, err error)
- func (db *Postgres) GetCommentsForTorrent(t *model.Torrent) (comments []model.Comment, err error)
- func (st *Postgres) GetFrontPageTorrents() (torrents []model.Torrent, err error)
- func (st *Postgres) GetTagByID(id uint64) (tag *model.Tag, err error)
- func (st *Postgres) GetTagByName(name string) (tag *model.Tag, err error)
- func (st *Postgres) GetTorrentFiles(ih [20]byte) (files []model.File, err error)
- func (db *Postgres) GetTorrentTags(t *model.Torrent) (tags []model.Tag, err error)
- func (db *Postgres) HasTorrent(ih [20]byte) (has bool, err error)
- func (st *Postgres) Init() (err error)
- func (db *Postgres) InsertComment(text string, ih [20]byte) (err error)
- func (st *Postgres) ListPopularTags(limit int) (tags []model.Tag, err error)
- func (st *Postgres) StoreTorrent(t *model.Torrent, i *metainfo.TorrentFile) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUserExists = errors.New("user already exists")
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { Init() error StoreTorrent(*model.Torrent, *metainfo.TorrentFile) error HasTorrent(ih [20]byte) (bool, error) FindTorrentByInfohash(ih [20]byte) (*model.Torrent, error) FindTorrentsWithTag(tag model.Tag) ([]model.Torrent, error) ListPopularTags(limit int) ([]model.Tag, error) GetTagByName(name string) (*model.Tag, error) GetTagByID(id uint64) (*model.Tag, error) GetCategoryByID(id int) (*model.Category, error) FindTorrentsInCategory(*model.Category, int, int) ([]model.Torrent, error) GetAllCategories() ([]model.Category, error) GetFrontPageTorrents() ([]model.Torrent, error) GetTorrentFiles(ih [20]byte) ([]model.File, error) CheckLogin(user, password string) (bool, error) AddUserLogin(username, password string) error DelUserLogin(username string) error InsertComment(text string, ih [20]byte) error GetCommentsForTorrent(*model.Torrent) ([]model.Comment, error) GetTorrentTags(*model.Torrent) ([]model.Tag, error) EnsureTags(tags []string) ([]model.Tag, error) AddTorrentTags(tags []model.Tag, t *model.Torrent) error DelTorrentTags(tags []model.Tag, t *model.Torrent) error AddCategory(name string) error DelCategory(name string) error DelTorrent(ih string) error }
DB defines actions required by a database driver
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
PQTorrentStorage is a postgresql torrent metadata storage implementation
func (*Postgres) AddCategory ¶
func (*Postgres) AddTorrentTags ¶
func (*Postgres) AddUserLogin ¶
func (*Postgres) CheckLogin ¶
func (*Postgres) DelCategory ¶
func (*Postgres) DelTorrent ¶
func (*Postgres) DelTorrentTags ¶
func (*Postgres) DelUserLogin ¶
func (*Postgres) EnsureTags ¶
func (*Postgres) FindTorrentByInfohash ¶
func (*Postgres) FindTorrentsInCategory ¶
func (*Postgres) FindTorrentsWithTag ¶
func (*Postgres) GetAllCategories ¶
func (*Postgres) GetCategoryByID ¶
func (*Postgres) GetCommentsForTorrent ¶
func (*Postgres) GetFrontPageTorrents ¶
func (*Postgres) GetTagByName ¶
func (*Postgres) GetTorrentFiles ¶
func (*Postgres) GetTorrentTags ¶
func (*Postgres) InsertComment ¶
func (*Postgres) ListPopularTags ¶
func (*Postgres) StoreTorrent ¶
Click to show internal directories.
Click to hide internal directories.