2023-03-03 05:51:53 +00:00
|
|
|
-- name: GetInvite :one
|
|
|
|
SELECT * FROM invites
|
2023-03-04 06:02:24 +00:00
|
|
|
WHERE code = ? LIMIT 1;
|
2023-03-03 05:51:53 +00:00
|
|
|
|
|
|
|
-- name: ListInvites :many
|
|
|
|
SELECT * FROM invites
|
2023-03-04 06:02:24 +00:00
|
|
|
ORDER BY id DESC;
|
2023-03-03 05:51:53 +00:00
|
|
|
|
|
|
|
-- name: CreateInvite :one
|
|
|
|
INSERT INTO invites (
|
|
|
|
code, uses, total, expiration
|
|
|
|
) VALUES (
|
|
|
|
?, ?, ?, ?
|
|
|
|
)
|
|
|
|
RETURNING *;
|
|
|
|
|
2023-03-04 06:02:24 +00:00
|
|
|
-- name: UpdateInvite :exec
|
|
|
|
UPDATE invites
|
|
|
|
SET uses = ?
|
|
|
|
WHERE id = ?;
|
|
|
|
|
2023-03-03 05:51:53 +00:00
|
|
|
-- name: DeleteInvite :exec
|
|
|
|
DELETE FROM invites
|
|
|
|
WHERE id = ?;
|
|
|
|
|
|
|
|
-- name: CountInvites :one
|
|
|
|
SELECT count(*) FROM invites;
|