feat(db): add GetBooksByTag query for tag detail page

Uses $2 = ANY(tags) to match against the tags text[] column with GIN
index support. sqlc generates a single string Column2 param (not []string).
This commit is contained in:
john-okeefe committed 2026-05-10 16:11:46 -04:00
1 parent ae2e03d499
commit fa38ca0d1b
3 files changed
+98

No files matched your search

+5
View File
@@ -2167,3 +2167,8 @@ SELECT
FROM libraries l
JOIN library_types lt ON l.library_type_id = lt.id
WHERE l.id = $1;
-- name: GetBooksByTag :many
SELECT * FROM media_items
WHERE library_id = $1 AND tags @> ARRAY[$2::text]
ORDER BY title ASC;