-- 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: GetUser :one
SELECT * FROM USERS
WHERE username = $1;


-- name: UpdatePassword :exec
UPDATE users
SET password = $1
WHERE id = $2;
