Documentation ¶
Index ¶
- Variables
- type File
- type MysqlRepo
- func (p *MysqlRepo) BatchDeleteInfohash(infohash []string) (err error)
- func (p *MysqlRepo) BatchGetInfohash(limit int64) (is []string, err error)
- func (p *MysqlRepo) BatchGetTorrentByInfohash(infohash []string) (ts []Torrent, err error)
- func (p *MysqlRepo) CreateHistory(keyword, source string) (err error)
- func (p *MysqlRepo) CreateInfohash(hash string) (err error)
- func (p *MysqlRepo) CreateTorrent(t Torrent) (err error)
- func (p *MysqlRepo) GetRecommend() (name []string, err error)
- func (p *MysqlRepo) GetTorrentByInfohash(infohash string) (t Torrent, err error)
- type Repository
- type Torrent
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
定义通用变量
Functions ¶
This section is empty.
Types ¶
type MysqlRepo ¶
type MysqlRepo struct {
// contains filtered or unexported fields
}
MysqlRepo 实现基于mysql的数据仓库
func NewMysqlRepository ¶
func NewMysqlRepository(conn string, maxIdleConns int, maxOpenConns int) (repo *MysqlRepo, err error)
NewMysqlRepository 新建mysql数据仓库
func (*MysqlRepo) BatchDeleteInfohash ¶
BatchDeleteInfohash 批量删除infohash
func (*MysqlRepo) BatchGetInfohash ¶
BatchGetInfohash 批量获取infohash
func (*MysqlRepo) BatchGetTorrentByInfohash ¶
BatchGetTorrentByInfohash 通过infohash批量查询资源
func (*MysqlRepo) CreateHistory ¶
CreateHistory 增加搜索历史
func (*MysqlRepo) CreateInfohash ¶
CreateInfohash 增加infohash
func (*MysqlRepo) CreateTorrent ¶
CreateTorrent 增加资源
func (*MysqlRepo) GetRecommend ¶
GetRecommend 获取推荐列表
type Repository ¶
type Repository interface { //Torrent GetTorrentByInfohash(infohash string) (torrent Torrent, err error) BatchGetTorrentByInfohash(infohash []string) (torrent []Torrent, err error) CreateTorrent(torrent Torrent) (err error) //Infohash BatchGetInfohash(limit int64) (infohash []string, err error) BatchDeleteInfohash(infohash []string) (err error) CreateInfohash(infohash string) (err error) //recommend GetRecommend() (name []string, err error) //history CreateHistory(keyword, source string) (err error) }
Repository 定义了数据仓库需要实现的接口
Click to show internal directories.
Click to hide internal directories.