db

package
v0.0.0-...-ed00c80 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMagent

func CreateMagent(ctx context.Context, url string) (int32, error)

CreateMagent ...

func CreateTask

func CreateTask(ctx context.Context, p *TaskParam) (int32, error)

CreateTask ...

func CreateTorrent

func CreateTorrent(ctx context.Context, p TorrentParam) (int32, error)

CreateTorrent ...

func DeleteMagnetByID

func DeleteMagnetByID(ctx context.Context, id int) error

DeleteMagnetByID ...

func DeleteTaskByID

func DeleteTaskByID(ctx context.Context, id int) error

DeleteTaskByID ...

func GetTorrentByMd5

func GetTorrentByMd5(ctx context.Context, md5 string) (*codegen.Torrent, error)

GetTorrentByMd5 ...

func Init

func Init(ctx context.Context, url string) (func(), error)

func SetTaskTotalBytes

func SetTaskTotalBytes(ctx context.Context, id int, total int64) error

SetTaskTotalBytes ...

func UpdateTaskDownloadedBytes

func UpdateTaskDownloadedBytes(ctx context.Context, id int, downloadBytes int64) error

UpdateTaskDownloadedBytes ...

func UpdateTaskStatus

func UpdateTaskStatus(ctx context.Context, id int, status string) error

UpdateTaskStatus ...

Types

type DownloadInfo

type DownloadInfo struct {
	TaskID         int
	URL, Directory string
}

func FilterDowloadInfos

func FilterDowloadInfos(ctx context.Context, status string) ([]DownloadInfo, error)

FilterDownloadInfos by status

func GetDownloadInfo

func GetDownloadInfo(ctx context.Context, id int) (*DownloadInfo, error)

type TaskParam

type TaskParam struct {
	Name string `json:"name"`
	TID  int    `json:"tid,omitempty"`
	MURL string `json:"magnet_url,omitempty"`
	Dir  string `json:"destination"`
}

TaskParam ...

func (TaskParam) Valid

func (t TaskParam) Valid() bool

type TaskResp

type TaskResp struct {
	ID            int32     `json:"id"`
	Name          string    `json:"name"`
	MagnetID      int32     `json:"magnet_id"`
	Directory     string    `json:"directory"`
	TotalBytes    int64     `json:"total_bytes"`
	DownloadBytes int64     `json:"download_bytes"`
	Status        string    `json:"status"`
	CreatedAt     time.Time `json:"create_at"`
	UpdatedAt     time.Time `json:"update_at"`
}

TaskResp ...

func GetTaskByID

func GetTaskByID(ctx context.Context, id int) (*TaskResp, error)

GetTaskByID ...

func ListTasks

func ListTasks(ctx context.Context, p *utils.Pagination) ([]*TaskResp, error)

ListTasks ...

type TorrentParam

type TorrentParam struct {
	MagnetID int32
	Filename string
	Path     string
	Md5      string
}

TorrentParam ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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