initial commit
This commit is contained in:
42
torrent.go
Normal file
42
torrent.go
Normal file
@ -0,0 +1,42 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Torrent struct {
|
||||
ID TorrentID
|
||||
Title string
|
||||
Link string
|
||||
Time time.Time
|
||||
Seeders int
|
||||
Leechers int
|
||||
Downloads int
|
||||
Trusted bool
|
||||
}
|
||||
|
||||
type TorrentID string
|
||||
|
||||
func (t Torrent) String() string {
|
||||
return fmt.Sprintf("id: %s | title: %s | seeders: %d | leechers: %d | downloads: %d | trusted: %t | upload time: %s",
|
||||
t.ID,
|
||||
t.Title,
|
||||
t.Seeders,
|
||||
t.Leechers,
|
||||
t.Downloads,
|
||||
t.Trusted,
|
||||
t.Time.Format("2006-01-02 15:04:05"),
|
||||
)
|
||||
}
|
||||
|
||||
func (t Torrent) StringWithoutTitle() string {
|
||||
return fmt.Sprintf("id: %s | seeders: %d | leechers: %d | downloads: %d | trusted: %t | upload time: %s",
|
||||
t.ID,
|
||||
t.Seeders,
|
||||
t.Leechers,
|
||||
t.Downloads,
|
||||
t.Trusted,
|
||||
t.Time.Format("2006-01-02 15:04:05"),
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user