Adopt sqlc for typed Postgres queries behind store entities.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
-- name: GetVote :one
|
||||
SELECT value
|
||||
FROM votes
|
||||
WHERE user_id = $1 AND question_id = $2;
|
||||
|
||||
-- name: DeleteVote :exec
|
||||
DELETE FROM votes
|
||||
WHERE user_id = $1 AND question_id = $2;
|
||||
|
||||
-- name: UpsertVote :exec
|
||||
INSERT INTO votes (user_id, question_id, value)
|
||||
VALUES ($1, $2, $3)
|
||||
ON CONFLICT (user_id, question_id) DO UPDATE
|
||||
SET value = excluded.value;
|
||||
Reference in New Issue
Block a user