aboutsummaryrefslogtreecommitdiff
path: root/internal/storage/entry.go
diff options
context:
space:
mode:
authorGravatar jvoisin <julien.voisin@dustri.org> 2024-02-26 11:44:03 +0100
committerGravatar Frédéric Guillot <f@miniflux.net> 2024-02-27 21:25:25 -0800
commitb054506e3a817f3bb7cf81f581e795a4e13c8c3f (patch)
tree1b78299e570fd2f8b03480b54d10dde95381bcc5 /internal/storage/entry.go
parentc961c6db7d149353537f302717adad9e26e4d50a (diff)
downloadv2-b054506e3a817f3bb7cf81f581e795a4e13c8c3f.tar.gz
v2-b054506e3a817f3bb7cf81f581e795a4e13c8c3f.tar.zst
v2-b054506e3a817f3bb7cf81f581e795a4e13c8c3f.zip
Use proper prepared statements for ArchiveEntries
Diffstat (limited to 'internal/storage/entry.go')
-rw-r--r--internal/storage/entry.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/storage/entry.go b/internal/storage/entry.go
index 64486f12..d79f899a 100644
--- a/internal/storage/entry.go
+++ b/internal/storage/entry.go
@@ -342,13 +342,13 @@ func (s *Storage) ArchiveEntries(status string, days, limit int) (int64, error)
status=$2 AND
starred is false AND
share_code='' AND
- created_at < now () - '%d days'::interval
+ created_at < now () - $3::interval
ORDER BY
- created_at ASC LIMIT %d
+ created_at ASC LIMIT $4
)
`
- result, err := s.db.Exec(fmt.Sprintf(query, days, limit), model.EntryStatusRemoved, status)
+ result, err := s.db.Exec(query, model.EntryStatusRemoved, status, fmt.Sprintf("%d days", days), limit)
if err != nil {
return 0, fmt.Errorf(`store: unable to archive %s entries: %v`, status, err)
}