-- name: CreateEmailConfirmation :one
INSERT INTO "email_confirmation" (
  "selector",
  "verifier",
  "valid_until",
  "email_address"
) VALUES (
  $1,
  $2,
  $3,
  $4
) RETURNING *;

-- name: GetEmailConfirmationBySelector :one
SELECT 
  *
FROM "email_confirmation" 
WHERE "selector" = $1
LIMIT 1;

-- name: GetEmailConfirmationByAddress :one
SELECT 
  *
FROM "email_confirmation" 
WHERE "email_address" = $1
LIMIT 1;

-- name: DestroyEmailConfirmation :exec
DELETE FROM "email_confirmation" WHERE "email_address" = $1;