PabloReszczynski / firetalk

MIT License
0 stars 0 forks source link

Query language #3

Open PabloReszczynski opened 3 years ago

PabloReszczynski commented 3 years ago

Determine a data language to query Firestore, and provide a full spec of it with clojure.spec. My initial approach would be something like this:

{:collection "movies"
 :where [[= "actor" "Bradley Cooper"]
         [< "year" 1990]]
 :limit 10}

should translate to something like this:

firestore.collection("movies")
  .whereEqualTo("actor", "Bradley Cooper")
  .whereGreaterThan("year", 1990)
  .limit(10);
PabloReszczynski commented 3 years ago

it should also work with subcollections:

{:collection ["genres", "horror", "movies"]
 :where [[< "year" 1985]]
 :order-by "year"}

should translate to something like:

firestore.collection("genres")
  .document("horror")
  .collection("movies")
  .whereGreaterThan("year", 1985)
  .orderBy("year")