This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-11
Channels
- # announcements (16)
- # aws (4)
- # babashka (30)
- # beginners (58)
- # bristol-clojurians (4)
- # cider (9)
- # clj-kondo (2)
- # clojure (229)
- # clojure-europe (25)
- # clojure-gamedev (1)
- # clojure-italy (4)
- # clojure-nl (13)
- # clojure-sanfrancisco (1)
- # clojure-uk (97)
- # clojured (7)
- # clojurescript (27)
- # code-reviews (2)
- # cursive (30)
- # data-science (39)
- # datomic (14)
- # emacs (12)
- # events (2)
- # fulcro (6)
- # graalvm (8)
- # graphql (14)
- # jackdaw (10)
- # jobs (2)
- # lambdaisland (5)
- # malli (4)
- # off-topic (28)
- # protorepl (13)
- # quil (7)
- # re-frame (2)
- # reagent (1)
- # reitit (3)
- # remote-jobs (5)
- # ring-swagger (1)
- # shadow-cljs (72)
- # sql (4)
- # tools-deps (182)
- # uncomplicate (4)
- # vim (9)
- # xtdb (19)
Hi folks, I am just getting used to Lacinia and GraphQL, with a basic question that I hope you can help me with. I refer to the critique here: https://github.com/vvvvalvalval/d2q#lacinia-and-graphql
They say "queries are difficult to compose and transform, which greatly hurts the programmability of GraphQL".
I wasn't able to figure out how to compose queries at all, actually, and I wonder if someone could give me some pointers.
What I understand from the documentation of Lacinia is that you can give it a list of queries, but there's no guarantee about execution order.
So, the specific use case I have in mind: I want to do something akin to a SELECT * FROM tablename_ -- in fact, that's basically how the query is implemented.
But then I would like to do further processing of the id field that returned from that query.
The docs say that mutations do have a guaranteed execution order, but it seems to me that these are usually used to update the database, rather than to update the results of a previous query.
I wonder, is this ever done? Using a mutation to update a query that has just run, I mean. So, in my case I could take the id field and expand the query results (e.g., by testing whether that id has other properties).
The alternative is to change the SELECT statement in the database backend, but this seems like a fairly hacky solution.
graphql is very much not sql, where as sql has a sort of transitive closure where a sql query can kind of be the input to another sql query, that isn't really the way graphql is structured, and graphql is really a facade that ties together different bits into a uniform model for clients, so it is entirely possible that yeah, based on slightly different queries from clients you might change which sql query you run, or maybe even change which datastore you consult
graphql mutations are analogous to like an update, insert, or delete in sql, where as queries are like a select, so talking about applying mutations to results of queries makes about as much sense as talking about applying an update to the result of a select (none)
if you look at something like https://www.howtographql.com/graphql-js/8-filtering-pagination-and-sorting/ the way it filters things is by passing the filter into the resolver, and if a filter is passed in the resolver applies it when resolving