2022-10-13 18:02:52 -05:00
|
|
|
-- name: GetFileByID :one
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
files
|
|
|
|
|
WHERE
|
|
|
|
|
id = $1
|
|
|
|
|
LIMIT
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
|
|
-- name: GetFileByHashAndCreator :one
|
2022-04-01 15:45:23 -05:00
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
files
|
|
|
|
|
WHERE
|
|
|
|
|
hash = $1
|
2022-10-13 18:02:52 -05:00
|
|
|
AND
|
|
|
|
|
created_by = $2
|
2022-04-01 15:45:23 -05:00
|
|
|
LIMIT
|
|
|
|
|
1;
|
|
|
|
|
|
2022-10-13 18:02:52 -05:00
|
|
|
|
2022-04-01 15:45:23 -05:00
|
|
|
-- name: InsertFile :one
|
|
|
|
|
INSERT INTO
|
2022-10-13 18:02:52 -05:00
|
|
|
files (id, hash, created_at, created_by, mimetype, "data")
|
2022-04-01 15:45:23 -05:00
|
|
|
VALUES
|
2022-10-13 18:02:52 -05:00
|
|
|
($1, $2, $3, $4, $5, $6) RETURNING *;
|