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.
 
 

22 lines
788 B

-- name: SelectChangeByID :one
SELECT * FROM data_change WHERE id = $1 LIMIT 1;
-- name: SelectChanges :many
SELECT * FROM data_change
WHERE (@filter_keys::bool = false OR keys && (@keys::text[]))
AND (@filter_earliest_date::bool = false OR date >= @earliest_date::timestamp)
AND (@filter_latest_date::bool = false OR date <= @latest_date::timestamp)
AND (@filter_author::bool = false OR author = @author::text)
ORDER BY date DESC
LIMIT NULLIF(@limit_size::INT, 0);
-- name: InsertChange :exec
INSERT INTO data_change (id, model, op, author, listed, date, keys, objects)
VALUES (
@id::text, @model::text, @op::text, @author::text,
@listed::boolean, @date::timestamp, @keys::text[],
@objects::jsonb
);
-- name: DeleteChange :exec
DELETE FROM data_change WHERE id = $1;