Redmage/db/queries/subreddits.sql

26 lines
493 B
MySQL
Raw Normal View History

2024-04-08 23:18:09 +07:00
-- name: SubredditsList :many
SELECT * FROM subreddits
2024-04-07 23:41:00 +07:00
ORDER BY name
2024-04-08 23:18:09 +07:00
LIMIT ? OFFSET ?;
2024-04-07 23:41:00 +07:00
2024-04-08 23:18:09 +07:00
-- 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
2024-04-07 23:41:00 +07:00
INSERT INTO subreddits (name, subtype, schedule)
VALUES (?, ?, ?)
RETURNING *;