Redmage/db/queries/devices.sql

29 lines
675 B
MySQL
Raw Normal View History

2024-04-14 17:30:04 +07:00
-- name: DeviceGetAll :many
SELECT * FROM devices
ORDER BY name;
2024-04-14 13:11:10 +07:00
2024-04-14 17:30:04 +07:00
-- name: DeviceCount :one
SELECT COUNT(*) FROM devices;
-- name: DeviceList :many
SELECT * FROM devices
ORDER BY name
LIMIT ? OFFSET ?;
-- name: DeviceSearch :many
SELECT * FROM devices
WHERE (name LIKE ? OR slug LIKE ?)
ORDER BY name
LIMIT ? OFFSET ?;
-- name: DeviceSearchCount :one
SELECT COUNT(*) FROM devices
WHERE (name LIKE ? OR slug LIKE ?)
ORDER BY name
LIMIT ? OFFSET ?;
-- name: DeviceCreate :one
INSERT INTO devices (name, slug, resolution_x, resolution_y, aspect_ratio_tolerance, min_x, min_y, max_x, max_y, nsfw, windows_wallpaper_mode)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2024-04-14 13:11:10 +07:00
RETURNING *;