String() method for Torrent implemented
This commit is contained in:
parent
e3f2c831ee
commit
67e9015e42
17
torrent.go
17
torrent.go
@ -1,6 +1,9 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Torrent struct {
|
type Torrent struct {
|
||||||
ID TorrentID
|
ID TorrentID
|
||||||
@ -14,3 +17,15 @@ type Torrent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TorrentID string
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user