diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-19 23:46:08 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-19 23:46:08 +0200 |
commit | 431a8ddb0c18b0781cba1d01eda3645b361f1b94 (patch) | |
tree | f67e427279e4e50d20c6acfa8ad22b51f2b5f7e6 /internal/feed/feed.go | |
parent | ed1e06e6d81645fb5fedd89018c30f95b7598f84 (diff) | |
download | feed2imap-go-431a8ddb0c18b0781cba1d01eda3645b361f1b94.tar.gz feed2imap-go-431a8ddb0c18b0781cba1d01eda3645b361f1b94.tar.bz2 feed2imap-go-431a8ddb0c18b0781cba1d01eda3645b361f1b94.zip |
Restructure
Diffstat (limited to '')
-rw-r--r-- | internal/feed/feed.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go new file mode 100644 index 0000000..59c15f2 --- /dev/null +++ b/internal/feed/feed.go @@ -0,0 +1,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() +} |