skeleton/internal/database/sql/queries/email.sql

28 lines
544 B
MySQL
Raw Normal View History

2020-07-19 14:08:18 +02:00
-- name: CreateEmail :one
INSERT INTO "email" (
"address", "user_id", "created_at"
) VALUES (
$1, $2, $3
) RETURNING *;
-- name: UpdateEmail :exec
UPDATE "email" SET (
"user_id", "created_at"
) = (
$1, $2
) WHERE "address" = $3;
-- name: DestroyEmail :exec
DELETE FROM "email" WHERE "address" = $1;
-- name: GetEmailByAddress :one
SELECT
"address", "user_id", "created_at"
FROM "public"."email"
WHERE "address" = $1;
-- name: GetEmailByUserID :one
SELECT
"address", "user_id", "created_at"
FROM "public"."email"
WHERE "user_id" = $1;