Skip to content

Instantly share code, notes, and snippets.

View ckshekhar's full-sized avatar

Chandrashekhar ckshekhar

View GitHub Profile
@ckshekhar
ckshekhar / create-postgres-read-only-user.sql
Last active October 29, 2020 10:11
Create a read-only postgres user
-- Create a readonly role
CREATE ROLE readonly;
-- Connect to the database on which you want to modify the user's privileges on.
-- Grant connect on the database.
GRANT CONNECT ON DATABASE database TO readonly;
-- Grant usage on the schema.
GRANT USAGE ON SCHEMA schema TO readonly;
@ckshekhar
ckshekhar / with-schema.clj
Created July 10, 2019 09:05 — forked from ikitommi/with-schema.clj
Schema coercion, how to do this with spec?
; (./pull '[prismatic/schema "1.1.3"])
(require '[schema.core :as schema])
(require '[schema.coerce :as coerce])
;; let's define some matchers
(def matchers
{:string coerce/string-coercion-matcher ;; used with ring query-, path- & form-params
:json coerce/json-coercion-matcher ;; used with body/response for "application/json"
:edn (constantly nil)}) ;; used with body/response for "application/edn"