The ClojureScript client of stratus (Clojars com.stratus-db/client), for server-side callers (Node): transit-json requests (keywords, UUIDs and instants native), gzipped transit-json responses (fetch inflates them). Every function returns a js/Promise.
The hosted API (https://api.stratus-db.com), with an API key:
(def conn (client/connect "https://api.stratus-db.com" {:api-key (.-STRATUS_API_KEY js/process.env)})) (-> (client/create-db! conn {:name "orders" :primary-key :order/id}) (.then (fn [{:keys [id]}] (client/transact! conn id {:tx [{:order/id (client/squuid) :total 5}]}))))
Databases are at <url>/v1/dbs/<id>/..., the key sent as "Authorization: Bearer <key>".
The internal service (techascent's), with requests signed: (client/connect catalog-url {:sign f}), f taking the request as a js object in the AWS SDK signer's shape ({:method :protocol :hostname :port :path :query :headers :body}) to a promise of it signed - stratus-db.sigv4/ signer (clients/cljs/sigv4, not published: it needs the AWS SDK's signer, which the hosted API doesn't, so this library has no npm dependencies). Databases are addressed by id: their Function URLs come from the catalog, cached, and looked up again periodically (:resolve-ms, default 5 minutes) and when a URL fails (403, 404). Busy databases answer 429: retried with backoff. The high-level functions resolve to the response body and reject with an ex-info {:status :error :message} on an error; call gives {:status :body} as it is. The query language: docs/query.md.
The ClojureScript client of stratus (Clojars com.stratus-db/client), for server-side callers
(Node): transit-json requests (keywords, UUIDs and instants native), gzipped transit-json
responses (fetch inflates them). Every function returns a js/Promise.
The hosted API (https://api.stratus-db.com), with an API key:
(def conn (client/connect "https://api.stratus-db.com" {:api-key (.-STRATUS_API_KEY js/process.env)}))
(-> (client/create-db! conn {:name "orders" :primary-key :order/id})
(.then (fn [{:keys [id]}] (client/transact! conn id {:tx [{:order/id (client/squuid) :total 5}]}))))
Databases are at <url>/v1/dbs/<id>/..., the key sent as "Authorization: Bearer <key>".
The internal service (techascent's), with requests signed: (client/connect catalog-url {:sign
f}), f taking the request as a js object in the AWS SDK signer's shape ({:method :protocol
:hostname :port :path :query :headers :body}) to a promise of it signed - stratus-db.sigv4/
signer (clients/cljs/sigv4, not published: it needs the AWS SDK's signer, which the hosted API
doesn't, so this library has no npm dependencies). Databases are addressed by id: their
Function URLs come from the catalog, cached, and looked up again periodically (:resolve-ms,
default 5 minutes) and when a URL fails (403, 404). Busy
databases answer 429: retried with backoff. The high-level functions resolve to the response
body and reject with an ex-info {:status :error :message} on an error; call gives
{:status :body} as it is. The query language: docs/query.md.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |