|
|
|
@ -84,7 +84,7 @@ func (s *Storage) createEntry(entry *model.Entry) error { |
|
|
|
|
).Scan(&entry.ID, &entry.Status) |
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
return fmt.Errorf("unable to create entry %q (feed #%d): %v", entry.URL, entry.FeedID, err) |
|
|
|
|
return fmt.Errorf("Unable to create entry %q (feed #%d): %v", entry.URL, entry.FeedID, err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i < len(entry.Enclosures); i++ { |
|
|
|
@ -137,9 +137,9 @@ func (s *Storage) updateEntry(entry *model.Entry) error { |
|
|
|
|
// entryExists checks if an entry already exists based on its hash when refreshing a feed.
|
|
|
|
|
func (s *Storage) entryExists(entry *model.Entry) bool { |
|
|
|
|
var result int |
|
|
|
|
query := `SELECT count(*) as c FROM entries WHERE user_id=$1 AND feed_id=$2 AND hash=$3` |
|
|
|
|
query := `SELECT 1 FROM entries WHERE user_id=$1 AND feed_id=$2 AND hash=$3` |
|
|
|
|
s.db.QueryRow(query, entry.UserID, entry.FeedID, entry.Hash).Scan(&result) |
|
|
|
|
return result >= 1 |
|
|
|
|
return result == 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// cleanupEntries deletes from the database entries marked as "removed" and not visible anymore in the feed.
|
|
|
|
|