28 lines
544 B
MySQL
28 lines
544 B
MySQL
|
-- 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;
|