26 lines
474 B
SQL
26 lines
474 B
SQL
-- name: GetShare :one
|
|
SELECT
|
|
id,
|
|
entity_type,
|
|
entity_id,
|
|
entity_date,
|
|
owner,
|
|
expiration
|
|
FROM shares
|
|
WHERE id = @id;
|
|
|
|
-- name: CreateShare :exec
|
|
INSERT INTO shares (
|
|
id,
|
|
entity_type,
|
|
entity_id,
|
|
entity_date,
|
|
owner,
|
|
expiration
|
|
) VALUES (@id, @entity_type, @entity_id, sqlc.narg('entity_date'), @owner, sqlc.narg('expiration'));
|
|
|
|
-- name: DeleteShare :exec
|
|
DELETE FROM shares WHERE id = @id;
|
|
|
|
-- name: PruneShares :exec
|
|
DELETE FROM shares WHERE expiration < NOW();
|