-- name: CreateOtp :exec INSERT INTO otps (sent_to, medium, otp_for, otp, used, created_at, expires_at) VALUES ($1, $2, $3, $4, FALSE, $5, $6); -- name: GetOtp :one SELECT id, sent_to, medium, otp_for, otp, used, used_at, created_at, expires_at FROM otps WHERE sent_to = $1 AND otp_for = $2 AND medium = $3 ORDER BY created_at DESC LIMIT 1; -- name: MarkOtpAsUsed :exec UPDATE otps SET used = TRUE, used_at = $2 WHERE id = $1;