summaryrefslogtreecommitdiffstats
path: root/db/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'db/db.go')
-rw-r--r--db/db.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/db.go b/db/db.go
index 6dfda22..bbe5b36 100644
--- a/db/db.go
+++ b/db/db.go
@@ -82,3 +82,17 @@ func (fdb *FernDB) Exists(feed, entry string) bool {
}
+func (fdb *FernDB) Add(feed, entry string) {
+ // Check if entry already exist for feed.
+ if fdb.Exists(feed, entry) {
+ return
+ }
+
+ // Add entry.
+ fdb.mutex.Lock()
+ if _, ok := fdb.downloaded[feed]; !ok {
+ fdb.downloaded[feed] = make([]string, 0)
+ }
+ fdb.downloaded[feed] = append(fdb.downloaded[feed], entry)
+ fdb.mutex.Unlock()
+}