hiling_go/db/queries/users.sql
2023-09-12 17:07:03 +07:00

23 lines
430 B
SQL

-- name: CreateUser :one
INSERT INTO users (
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;