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
347 B
8 lines
347 B
-- name: EnsureCounter :exec
|
|
INSERT INTO core_counter (id, value) VALUES (@id::text, 0) ON CONFLICT DO NOTHING;
|
|
|
|
-- name: IncrementCounter :one
|
|
UPDATE core_counter SET value = value + 1 WHERE id = @id::text RETURNING value::int;
|
|
|
|
-- name: BumpCounter :exec
|
|
UPDATE core_counter SET value = @value::int WHERE id = @id::text AND value <= @value::int;
|