1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Do not crawl existing entry URLs

This commit is contained in:
Frédéric Guillot 2018-01-19 18:43:27 -08:00
parent 09785df07f
commit 3b62f904d6
3 changed files with 23 additions and 8 deletions

View file

@ -226,3 +226,11 @@ func (s *Storage) MarkAllAsRead(userID int64) error {
return nil
}
// EntryURLExists returns true if an entry with this URL already exists.
func (s *Storage) EntryURLExists(userID int64, entryURL string) bool {
var result int
query := `SELECT count(*) as c FROM entries WHERE user_id=$1 AND url=$2`
s.db.QueryRow(query, userID, entryURL).Scan(&result)
return result >= 1
}