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.

7 lines
345 B

  1. -- name: EnsureCounter :exec
  2. INSERT INTO core_counter (id, value) VALUES (@id::text, 0) ON CONFLICT DO NOTHING;
  3. -- name: IncrementCounter :one
  4. UPDATE core_counter SET value = value + 1 WHERE id = @id::text RETURNING value::int;
  5. -- name: BumpCounter :exec
  6. UPDATE core_counter SET value = value + 1 WHERE id = @id::text AND value <= @value::int;