diff options
author | 2024-04-04 19:44:58 -0700 | |
---|---|---|
committer | 2024-04-04 20:22:23 -0700 | |
commit | fdd1b3f18e60a53fe703d63b0bf4663c835e7277 (patch) | |
tree | ca16fae1c4df8a10da406ce69cc90f2d6b4a1cd9 /internal/storage/entry.go | |
parent | 6e870cdccc9ac845b678b349e880100cbe32453c (diff) | |
download | v2-fdd1b3f18e60a53fe703d63b0bf4663c835e7277.tar.gz v2-fdd1b3f18e60a53fe703d63b0bf4663c835e7277.tar.zst v2-fdd1b3f18e60a53fe703d63b0bf4663c835e7277.zip |
database: entry URLs can exceeds btree index size limit
Diffstat (limited to '')
-rw-r--r-- | internal/storage/entry.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/internal/storage/entry.go b/internal/storage/entry.go index 1a7cc6d7..867338f7 100644 --- a/internal/storage/entry.go +++ b/internal/storage/entry.go @@ -225,6 +225,12 @@ func (s *Storage) entryExists(tx *sql.Tx, entry *model.Entry) (bool, error) { return result, nil } +func (s *Storage) IsNewEntry(feedID int64, entryHash string) bool { + var result bool + s.db.QueryRow(`SELECT true FROM entries WHERE feed_id=$1 AND hash=$2`, feedID, entryHash).Scan(&result) + return !result +} + // GetReadTime fetches the read time of an entry based on its hash, and the feed id and user id from the feed. // It's intended to be used on entries objects created by parsing a feed as they don't contain much information. // The feed param helps to scope the search to a specific user and feed in order to avoid hash clashes. @@ -575,14 +581,6 @@ func (s *Storage) MarkCategoryAsRead(userID, categoryID int64, before time.Time) return nil } -// EntryURLExists returns true if an entry with this URL already exists. -func (s *Storage) EntryURLExists(feedID int64, entryURL string) bool { - var result bool - query := `SELECT true FROM entries WHERE feed_id=$1 AND url=$2` - s.db.QueryRow(query, feedID, entryURL).Scan(&result) - return result -} - // EntryShareCode returns the share code of the provided entry. // It generates a new one if not already defined. func (s *Storage) EntryShareCode(userID int64, entryID int64) (shareCode string, err error) { |