skeleton/internal/database/sql/queries/reset.sql

27 lines
435 B
MySQL
Raw Normal View History

2020-07-19 14:08:18 +02:00
-- name: CreateReset :one
2020-07-21 22:50:11 +02:00
INSERT INTO "password_reset" (
"identity_id",
"selector",
"verifier",
"valid_until"
2020-07-19 14:08:18 +02:00
) VALUES (
2020-07-21 22:50:11 +02:00
$1,
$2,
$3,
$4
2020-07-19 14:08:18 +02:00
) RETURNING *;
-- name: DestroyReset :exec
2020-07-21 22:50:11 +02:00
DELETE FROM "password_reset" WHERE "selector" = $1;
2020-07-19 14:08:18 +02:00
-- name: GetResetBySelector :one
SELECT
2020-07-21 22:50:11 +02:00
*
FROM "password_reset"
2020-07-19 14:08:18 +02:00
WHERE "selector" = $1;
2020-07-21 22:50:11 +02:00
-- name: GetResetByIdentityID :one
2020-07-19 14:08:18 +02:00
SELECT
2020-07-21 22:50:11 +02:00
*
FROM "password_reset"
WHERE "identity_id" = $1;