Redmage/db/queries/subreddits.sql
2024-04-09 21:49:23 +07:00

29 lines
552 B
SQL

-- name: SubredditsGetAll :many
SELECT * FROM subreddits;
-- name: SubredditsList :many
SELECT * FROM subreddits
ORDER BY name
LIMIT ? OFFSET ?;
-- name: SubredditsListCount :one
SELECT COUNT(*) From subreddits;
-- name: SubredditsSearch :many
SELECT * FROM subreddits
WHERE name LIKE ?
ORDER BY name
LIMIT ? OFFSET ?;
-- name: SubredditsSearchCount :one
SELECT COUNT(*) FROM subreddits
WHERE name LIKE ?
ORDER BY name
LIMIT ? OFFSET ?;
-- name: SubredditCreate :one
INSERT INTO subreddits (name, subtype, schedule)
VALUES (?, ?, ?)
RETURNING *;