aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/articles.sql.go
diff options
context:
space:
mode:
authornsfisis <54318333+nsfisis@users.noreply.github.com>2026-01-12 18:13:30 +0900
committerGitHub <noreply@github.com>2026-01-12 18:13:30 +0900
commit8ca7887979bb045eea6331360b2bedc6de7f3d34 (patch)
treefbf632ed9c179dd109afa6e1749a446f540a45c4 /backend/db/articles.sql.go
parent67bfaf8f103295c5562db02a0044e311e3504518 (diff)
parent86254f8eb7f812915464c8733f7017a6e0a3dd4d (diff)
downloadfeedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.gz
feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.zst
feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.zip
Merge pull request #2 from nsfisis/claude/deduplicate-feed-items-JDLw3HEADmain
Prevent duplicate feed items with same GUID
Diffstat (limited to 'backend/db/articles.sql.go')
-rw-r--r--backend/db/articles.sql.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/db/articles.sql.go b/backend/db/articles.sql.go
index bf6ea1d..7f6400b 100644
--- a/backend/db/articles.sql.go
+++ b/backend/db/articles.sql.go
@@ -28,6 +28,20 @@ func (q *Queries) CheckArticleExists(ctx context.Context, arg CheckArticleExists
return article_exists, err
}
+const checkArticleExistsByGUID = `-- name: CheckArticleExistsByGUID :one
+SELECT EXISTS(
+ SELECT 1 FROM articles
+ WHERE guid = ?
+) as article_exists
+`
+
+func (q *Queries) CheckArticleExistsByGUID(ctx context.Context, guid string) (int64, error) {
+ row := q.db.QueryRowContext(ctx, checkArticleExistsByGUID, guid)
+ var article_exists int64
+ err := row.Scan(&article_exists)
+ return article_exists, err
+}
+
const createArticle = `-- name: CreateArticle :one
INSERT INTO articles (feed_id, guid, title, url, is_read)
VALUES (?, ?, ?, ?, ?)