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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user