You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
-- name: SelectComment :one
|
|
SELECT * FROM story_comment WHERE id=$1;
|
|
|
|
-- name: InsertComment :exec
|
|
INSERT INTO story_comment (id, chapter_id, character_id, subject, author, character_name, source, created_date, fictional_date, edited_date)
|
|
VALUES (
|
|
@id, @chapter_id, @character_id,
|
|
@subject, @author, @character_name, @source,
|
|
@created_date, @fictional_date, @edited_date
|
|
);
|
|
|
|
-- name: UpdateComment :exec
|
|
UPDATE story_comment
|
|
SET subject = @subject,
|
|
source = @source,
|
|
fictional_date = @fictional_date,
|
|
edited_date = @edited_date,
|
|
character_name = @character_name,
|
|
character_id = @character_id
|
|
WHERE id = @id;
|
|
|
|
-- name: SelectComments :many
|
|
SELECT * FROM story_comment
|
|
WHERE (@chapter_id = '' OR chapter_id = @chapter_id)
|
|
ORDER BY fictional_date, created_date
|
|
LIMIT NULLIF(@limit_size::INT, 0);
|
|
|
|
-- name: DeleteComment :exec
|
|
DELETE FROM story_comment WHERE id = $1;
|
|
|
|
-- name: DeleteCommentsByChapterID :exec
|
|
DELETE FROM story_comment WHERE chapter_id = $1;
|
|
|
|
-- name: DeleteCommentsByStoryID :exec
|
|
DELETE FROM story_comment
|
|
WHERE chapter_id IN (
|
|
SELECT id FROM story_chapter WHERE story_id = $1
|
|
);
|