hugo-cms/sql/queries/posts.sql

20 lines
433 B
MySQL
Raw Normal View History

2025-01-27 03:23:54 +00:00
-- name: ListPosts :many
SELECT * FROM post WHERE site_id = $1 ORDER BY post_date DESC LIMIT 25;
2025-01-27 04:45:53 +00:00
-- name: ListPublishablePosts :many
SELECT *
FROM post
WHERE id > $1 AND site_id = $2 AND state = 'published' AND post_date <= $3
ORDER BY id LIMIT 100;
2025-01-27 03:23:54 +00:00
-- name: InsertPost :one
INSERT INTO post (
site_id,
title,
body,
state,
props,
post_date,
created_at
) VALUES ($1, $2, $3, $4, $5, $6, $7)
RETURNING id;