22 lines
372 B
MySQL
22 lines
372 B
MySQL
|
-- name: GetInvite :one
|
||
|
SELECT * FROM invites
|
||
|
WHERE id = ? LIMIT 1;
|
||
|
|
||
|
-- name: ListInvites :many
|
||
|
SELECT * FROM invites
|
||
|
ORDER BY id;
|
||
|
|
||
|
-- name: CreateInvite :one
|
||
|
INSERT INTO invites (
|
||
|
code, uses, total, expiration
|
||
|
) VALUES (
|
||
|
?, ?, ?, ?
|
||
|
)
|
||
|
RETURNING *;
|
||
|
|
||
|
-- name: DeleteInvite :exec
|
||
|
DELETE FROM invites
|
||
|
WHERE id = ?;
|
||
|
|
||
|
-- name: CountInvites :one
|
||
|
SELECT count(*) FROM invites;
|