22 lines
372 B
SQL
22 lines
372 B
SQL
-- 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; |