Skip to content
Snippets Groups Projects
_ds_postgres_cache.sql 570 B
Newer Older
-- :name create-document-cache! :! :n
-- :doc creates a new document cache record
INSERT INTO :i:cache-table
            (repository, "document", "version", "data")
VALUES (:repository-name, :document-id, :version, :data)
       ON CONFLICT(repository, "document", "version")
       DO UPDATE SET "data" = :data

-- :name get-cached-document :? :1
-- :doc retrieve cached document.
SELECT * FROM :i:cache-table  WHERE "repository" = :repository-name
                                AND "document" =  :document-id
                                AND "version" = :version