Liking cljdoc? Tell your friends :D

supabase.postgrest

Idiomatic Clojure builder for the PostgREST API.

Builds a request map via thread-first, then execute runs it through supabase.core.http and returns either a response or an anomaly.

Quick start

(require '[supabase.core.client :as sc]
         '[supabase.postgrest :as pg])

(def client (sc/make-client "https://abc.supabase.co" "anon-key"))

;; SELECT
(-> (pg/from client "users")
    (pg/select "*")
    (pg/eq "active" true)
    (pg/order "created_at")
    (pg/limit 10)
    (pg/execute))

;; INSERT
(-> (pg/from client "users")
    (pg/insert {:email "a@b.com"})
    (pg/execute))

;; UPDATE filtered
(-> (pg/from client "users")
    (pg/eq "id" 42)
    (pg/update {:name "Jane"})
    (pg/execute))

;; DELETE filtered
(-> (pg/from client "users")
    (pg/eq "id" 42)
    (pg/delete)
    (pg/execute))

;; RPC
(-> (pg/rpc client "my_function" {:arg 1})
    (pg/execute))

See sub-namespaces for the full API:

  • supabase.postgrest.filters — eq / gt / like / contains / and / or / not / ...
  • supabase.postgrest.query — select / insert / upsert / update / delete / rpc / aggregations
  • supabase.postgrest.transform— order / limit / range / single / csv / explain / returning / ...
Idiomatic Clojure builder for the PostgREST API.

Builds a request map via thread-first, then `execute` runs it through
`supabase.core.http` and returns either a response or an anomaly.

## Quick start

    (require '[supabase.core.client :as sc]
             '[supabase.postgrest :as pg])

    (def client (sc/make-client "https://abc.supabase.co" "anon-key"))

    ;; SELECT
    (-> (pg/from client "users")
        (pg/select "*")
        (pg/eq "active" true)
        (pg/order "created_at")
        (pg/limit 10)
        (pg/execute))

    ;; INSERT
    (-> (pg/from client "users")
        (pg/insert {:email "a@b.com"})
        (pg/execute))

    ;; UPDATE filtered
    (-> (pg/from client "users")
        (pg/eq "id" 42)
        (pg/update {:name "Jane"})
        (pg/execute))

    ;; DELETE filtered
    (-> (pg/from client "users")
        (pg/eq "id" 42)
        (pg/delete)
        (pg/execute))

    ;; RPC
    (-> (pg/rpc client "my_function" {:arg 1})
        (pg/execute))

See sub-namespaces for the full API:
  - `supabase.postgrest.filters`  — eq / gt / like / contains / and / or / not / ...
  - `supabase.postgrest.query`    — select / insert / upsert / update / delete / rpc / aggregations
  - `supabase.postgrest.transform`— order / limit / range / single / csv / explain / returning / ...
raw docstring

all-ofclj

source

any-ofclj

source

avgclj

source

contained-byclj

source

containsclj

source

countclj

source

csvclj

source

deleteclj

source

eqclj

source

executeclj

(execute req)

Runs the built request. Returns {:status :body :headers} or an anomaly enriched with PostgREST error metadata.

Runs the built request. Returns `{:status :body :headers}` or an
anomaly enriched with PostgREST error metadata.
sourceraw docstring

explainclj

source

filterclj

source

fromclj

(from c table)

Starts a builder bound to table. Returns a request map you can thread through filters / verbs / transforms before calling execute. Returns an anomaly if the client is invalid.

Starts a builder bound to `table`. Returns a request map you can
thread through filters / verbs / transforms before calling `execute`.
Returns an anomaly if the client is invalid.
sourceraw docstring

geojsonclj

source

gtclj

source

gteclj

source

ilikeclj

source

ilike-all-ofclj

source

ilike-any-ofclj

source

insertclj

source

isclj

source

likeclj

source

like-all-ofclj

source

like-any-ofclj

source

limitclj

source

ltclj

source

lteclj

source

matchclj

source

maxclj

source

maybe-singleclj

source

minclj

source

negateclj

source

neqclj

source

orderclj

source

overlapsclj

source

rangeclj

source

range-adjacentclj

source

range-gtclj

source

range-gteclj

source

range-ltclj

source

range-lteclj

source

returningclj

source

rollbackclj

source

rpcclj

source

schemaclj

(schema req new-schema)

Override the schema used for THIS request only. Defaults to the client's :db :schema.

Override the schema used for THIS request only. Defaults to the
client's `:db :schema`.
sourceraw docstring

selectclj

source

singleclj

source

sumclj

source

source

updateclj

source

upsertclj

source

with-custom-media-typeclj

(with-custom-media-type req media-type)

Override the accept header via a media-type keyword.

Valid keys: :default, :csv, :json, :openapi, :postgis, :pgrst-plan, :pgrst-object, :pgrst-array.

Override the accept header via a media-type keyword.

Valid keys: `:default`, `:csv`, `:json`, `:openapi`, `:postgis`,
`:pgrst-plan`, `:pgrst-object`, `:pgrst-array`.
sourceraw docstring

withinclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close