blob: 59c15f25835378af5b90835423871dd22489687c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package feed
import (
"fmt"
"strings"
"github.com/mmcdole/gofeed"
"github.com/Necoro/feed2imap-go/internal/config"
)
type Feed struct {
Name string
Target []string
Url string
config.Options
feed gofeed.Feed
}
type Feeds map[string]*Feed
func (f Feeds) String() string {
var b strings.Builder
app := func(a ...interface{}) {
_, _ = fmt.Fprint(&b, a...)
}
app("Feeds [")
first := true
for k, v := range f {
if !first {
app(", ")
}
app(`"`, k, `"`, ": ")
if v == nil {
app("<nil>")
} else {
_, _ = fmt.Fprintf(&b, "%+v", *v)
}
first = false
}
app("]")
return b.String()
}
|