Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avelino/cljs-google-datastore
Google Cloud Datastore client to ClojureScript
https://github.com/avelino/cljs-google-datastore
clojurescript clojurescript-library google-cloud-datastore google-datastore
Last synced: 26 days ago
JSON representation
Google Cloud Datastore client to ClojureScript
- Host: GitHub
- URL: https://github.com/avelino/cljs-google-datastore
- Owner: avelino
- License: mit
- Created: 2020-04-10T11:22:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-21T10:49:24.000Z (over 4 years ago)
- Last Synced: 2024-07-23T04:23:52.421Z (4 months ago)
- Topics: clojurescript, clojurescript-library, google-cloud-datastore, google-datastore
- Language: Clojure
- Homepage: https://clojars.org/cljs-google-datastore
- Size: 23.4 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Google Cloud Datastore
Interoperability `@google-cloud/datastore` to cljs (_ClojureScript_)[![Clojars Project](https://img.shields.io/clojars/v/cljs-google-datastore.svg)](https://clojars.org/cljs-google-datastore)
## Installation
Add package dependencie in `project.clj`:
``` clojure
(defproject hello-world "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.9.0"]
[cljs-google-datastore "1.0.0"]])
```Download dependencies:
``` shell
lein deps
```## Example
``` clojure
(ns core
(:require [cljs-google-datastore.core :as datastore]))(defn- main []
(let [ds (datastore/datastore)
data {:created (.toJSON (new js/Date))
:name "Google Cloud Datastore by cljs"
:url "https://github.com/avelino/cljs-google-datastore"}]);; save data
(-> (datastore/save ds "KEY-NAME" data)
(.then (fn [r] (prn r))));; update data - key 123
(-> (datastore/save ds "KEY-NAME" data :key 123)
(.then (fn [r] (prn r))));; delete - key 123
(-> (datastore/delete ds "KEY-NAME" 123)
(.then (fn [r] (prn r))))
;; get records -- apply filters
(-> (datastore/query ds
"KEY-NAME"
{:created [[">" (.toJSON (new js/Date "2020-04-03T00:00:00z"))]
["<" (.toJSON (new js/Date "2020-04-09T00:00:00z"))]]
:active true}
:group ["created"]
:order {:created {:descending false}}
:limit 10)
(.then (fn [r] (println r)))))
```