-- name: ListResultsByDocumentID :many
SELECT id, queryId, queryVersion FROM results where documentId = $1 and cleanVersion >= $2 and textVersion >= $3;

-- name: ListResultValuesByID :many
SELECT id, queryId, value FROM results where id = ANY($1);

-- name: SetResult :one
INSERT INTO results (queryId, documentId, value, cleanVersion, textVersion, queryVersion) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id;