String() method for Torrent implemented

This commit is contained in:
Timon Ringwald 2022-08-15 14:52:35 +02:00
parent e3f2c831ee
commit 67e9015e42

View File

@ -1,6 +1,9 @@
package model
import "time"
import (
"fmt"
"time"
)
type Torrent struct {
ID TorrentID
@ -14,3 +17,15 @@ type Torrent struct {
}
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,
)
}