GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

8 lines
361 B

-- name: EnsureCounter :exec
INSERT INTO core_counter (id, value) VALUES ($1::text, 0) ON CONFLICT DO NOTHING;
-- name: IncrementCounter :one
UPDATE core_counter SET value = value + 1 WHERE id = $1::text RETURNING value::int;
-- name: BumpCounter :exec
UPDATE core_counter SET value = value + 1 WHERE id = sqlc.arg(id)::text AND value <= sqlc.arg(value)::int;