-- name: CreateSession :one
INSERT INTO sessions (id, user_id, expires_at)
VALUES ($1, $2, $3)
RETURNING *;

-- name: GetSession :one
SELECT * FROM sessions
WHERE id = $1 AND revoked = false AND expires_at > now();

-- name: RevokeSession :exec
UPDATE sessions SET revoked = true
WHERE id = $1;

-- name: RevokeAllUserSessions :exec
UPDATE sessions SET revoked = true
WHERE user_id = $1;
