Mirror for https://github.com/STBoyden/go-portfolio
at develop 538 B view raw
1-- name: NewAuth :one 2INSERT INTO "authorisations" (id) 3VALUES (gen_random_uuid()) 4RETURNING *; 5 6-- name: GetExpiredAuths :many 7SELECT * FROM "authorisations" WHERE "expiry" <= current_timestamp; 8 9-- name: GetAuthByToken :one 10SELECT * FROM "authorisations" WHERE "id" = @id::uuid LIMIT 1; 11 12-- name: CheckAuthExists :one 13SELECT EXISTS (SELECT * FROM "authorisations" WHERE "id" = @id::uuid); 14 15-- name: CheckIfAuthExpired :one 16SELECT EXISTS ( 17 SELECT * FROM "authorisations" 18 WHERE "id" = @id::uuid 19 AND "expiry" <= current_timestamp 20);