-- name: GetUserByEmail :one
SELECT * FROM users WHERE email = :email;

-- name: ListUsers :many
SELECT id, name, active FROM users ORDER BY name;

-- name: CountActive :one
SELECT COUNT(*) AS n FROM users WHERE active = :active;

-- name: CreateUser :exec
INSERT INTO users (email, name, active) VALUES (:email, :name, :active);

-- name: DeactivateUser :exec
UPDATE users SET active = 0 WHERE id = :id;
