1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

Add link to mark everything as read

This commit is contained in:
Frédéric Guillot 2018-01-04 18:11:15 -08:00
parent efac11e082
commit c57cafbef2
7 changed files with 39 additions and 6 deletions

View file

@ -213,3 +213,16 @@ func (s *Storage) FlushHistory(userID int64) error {
return nil
}
// MarkAllAsRead set all entries with the status "unread" to "read".
func (s *Storage) MarkAllAsRead(userID int64) error {
defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:MarkAllAsRead] userID=%d", userID))
query := `UPDATE entries SET status=$1 WHERE user_id=$2 AND status=$3`
_, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread)
if err != nil {
return fmt.Errorf("unable to mark all entries as read: %v", err)
}
return nil
}