This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-13
Channels
- # adventofcode (36)
- # aleph (1)
- # announcements (7)
- # aws (4)
- # babashka (14)
- # beginners (61)
- # calva (79)
- # cider (19)
- # clojure (48)
- # clojure-austin (1)
- # clojure-australia (2)
- # clojure-czech (2)
- # clojure-europe (46)
- # clojure-france (8)
- # clojure-nl (19)
- # clojure-uk (4)
- # clojuredesign-podcast (14)
- # core-logic (42)
- # data-science (3)
- # datalevin (8)
- # datomic (76)
- # events (1)
- # figwheel-main (9)
- # fulcro (6)
- # helix (1)
- # holy-lambda (1)
- # honeysql (2)
- # jobs (2)
- # jobs-discuss (20)
- # leiningen (5)
- # lsp (87)
- # minecraft (11)
- # nextjournal (4)
- # off-topic (17)
- # practicalli (1)
- # reagent (22)
- # reitit (8)
- # releases (3)
- # rum (2)
- # shadow-cljs (18)
- # sql (11)
- # tools-build (5)
- # tools-deps (9)
- # xtdb (20)
Hello. I’m looking at Site. Can valid time be specified on requests?
Worth mentioning the site is very alpha currently, I’m going to put up some better docs soon though
What is interesting is that I was recently thinking about the very same thing, except I thought it would be cool to have a tool that can generate an app based on a schema
Server code and UIs, yes
There have been some attempts at that https://github.com/vazco/uniforms, but I’m not convinced its a good idea
You can generate fetching logic for the frontend with this https://www.graphql-code-generator.com/. I am using it with react-query and it works great
I was talking more in the context of xtdb
Right.
Well, best of luck. I’ll play around with it
This code is in need of a refactor as we’re currently just prototyping, but you can see most of how the graphql schema gets turned into XTDB queries here https://github.com/juxt/site/blob/ba44b0241931c5f2e2228aae68006a858333bc65/src/juxt/site/alpha/graphql.clj#L634 (theres a big case statement to handle the various directives you can add to the schema, if none are added it will fall through to that ‘infer-query’ function. The ‘query’ function is called for every field in the graphql query, as per the graphql spec)
How do references work?
you can add a ‘ref’ directive, which takes the name of the key you want to join on. see here for details https://github.com/juxt/site/blob/ba44b0241931c5f2e2228aae68006a858333bc65/src/juxt/site/alpha/graphql.clj#L479
if the given id exists on the current xt document, it will do an entity lookup on that, otherwise it will do a query for documents with a type matching the return type on the field, and an attribute matching the given ref value
should probably keep this stuff in a thread, feel free to reply here if you want more help
Thanks @alex395