Use an update-where for MarkCategoryAsRead instead of a subquery
This commit is contained in:
parent
66e0eb1bd6
commit
bca84bac8b
1 changed files with 6 additions and 2 deletions
|
@ -545,14 +545,18 @@ func (s *Storage) MarkCategoryAsRead(userID, categoryID int64, before time.Time)
|
||||||
SET
|
SET
|
||||||
status=$1,
|
status=$1,
|
||||||
changed_at=now()
|
changed_at=now()
|
||||||
|
FROM
|
||||||
|
feeds
|
||||||
WHERE
|
WHERE
|
||||||
user_id=$2
|
feed_id=feeds.id
|
||||||
|
AND
|
||||||
|
feeds.user_id=$2
|
||||||
AND
|
AND
|
||||||
status=$3
|
status=$3
|
||||||
AND
|
AND
|
||||||
published_at < $4
|
published_at < $4
|
||||||
AND
|
AND
|
||||||
feed_id IN (SELECT id FROM feeds WHERE user_id=$2 AND category_id=$5)
|
feeds.category_id=$5
|
||||||
`
|
`
|
||||||
result, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread, before, categoryID)
|
result, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread, before, categoryID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue