Redmage/db/queries/subreddits.sql

29 lines
552 B
MySQL
Raw Normal View History

2024-04-09 21:49:23 +07:00
-- name: SubredditsGetAll :many
SELECT * FROM subreddits;
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 *;