2023-09-12 17:07:03 +07:00
|
|
|
-- name: CreateUser :one
|
2023-09-08 22:24:58 +07:00
|
|
|
INSERT INTO users (
|
2023-09-12 17:07:03 +07:00
|
|
|
username,
|
|
|
|
password
|
|
|
|
) VALUES ($1, $2)
|
|
|
|
RETURNING *;
|
|
|
|
|
|
|
|
-- name: UpdateUser :one
|
|
|
|
UPDATE users
|
|
|
|
SET
|
|
|
|
email = COALESCE(sqlc.narg(email), email),
|
|
|
|
username = COALESCE(sqlc.narg(username), username),
|
|
|
|
avatar_picture = COALESCE(sqlc.narg(avatar_picture), avatar_picture)
|
|
|
|
WHERE
|
|
|
|
id = sqlc.arg(id)
|
|
|
|
RETURNING *;
|
|
|
|
|
|
|
|
|
|
|
|
-- name: UpdatePassword :exec
|
|
|
|
UPDATE users
|
|
|
|
SET password = $1
|
|
|
|
WHERE id = $2;
|