This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-24
Channels
- # aws (7)
- # aws-lambda (3)
- # beginners (65)
- # boot (43)
- # cider (7)
- # cljs-dev (12)
- # cljsrn (15)
- # clojure (284)
- # clojure-austin (32)
- # clojure-brasil (4)
- # clojure-dusseldorf (4)
- # clojure-germany (1)
- # clojure-italy (40)
- # clojure-spec (21)
- # clojure-uk (69)
- # clojurescript (97)
- # core-async (11)
- # cursive (19)
- # data-science (1)
- # datascript (6)
- # datomic (30)
- # dirac (2)
- # emacs (4)
- # events (2)
- # fulcro (76)
- # graphql (38)
- # juxt (1)
- # lein-figwheel (1)
- # leiningen (6)
- # luminus (4)
- # lumo (13)
- # mount (4)
- # off-topic (24)
- # om (28)
- # onyx (32)
- # other-languages (1)
- # parinfer (40)
- # pedestal (1)
- # portkey (47)
- # re-frame (21)
- # reagent (4)
- # ring (4)
- # ring-swagger (3)
- # rum (1)
- # shadow-cljs (115)
- # spacemacs (5)
- # sql (14)
- # unrepl (1)
- # yada (3)
Hello people, today I like to share a video with you, this video shows a way that you can get auto-complete exploratory features for your Om.next graphs. This is a combinations of technologies, being Pathom a backend library that helps you write your parsers, and OgE, that's a web interface to explore your graph. I made a video to demonstrate how you can combine those and have a good exploratory solution for your graphs, I hope you enjoy it: https://www.youtube.com/watch?v=60i9uStI9As
@wilkerlucio Very cool, have you thought about generating the parser index from clojure.spec fspec
’s?
bravo !
@gardnervickers thanks 🙂, yes, actually, if there is a spec it will try to infer automatically from that, the major problem here is that spec keys
doesn't support describing nested structures, which is important for many resolvers
but if your resolver has a flat output, and you have a spec for it, pathom will infer automatically, you just need to send the symbol
Hello guys! I have the current atom as database (atom {:navbar {:active "index" :current-user "user"}})
Is there a reason why the query
(parser {:state state} [{:navbar [:active]}])
returns the whole atom? aka:
{:navbar {:active "index", :current-user "user"}}
Here's my read fn
(defn read
[{:keys [state] :as env} key params]
(let [st @state]
(if-let [[_ v] (find st key)]
{:value v}
{:value :not-found})))
@vinnyataide the parser only runs for the top-level attributes, it's your job to call it recursively if you wanna have sub-queries working
see that at {:value v}
you are returning the full :navbar
, so that's what you see in your response
if you don't care much about a custom local parser, I recommend you to try fulcro, with that you can eliminate the need for a local parser
or, if you wanna know more about writing parsers, you can read my article about that 🙂 https://medium.com/@wilkerlucio/implementing-custom-om-next-parsers-f20ca6db1664
but just as a heads up, I think with this code your parser would work (for this case you mentioned at least):
@wilkerlucio I'll definitely look at your parser article. Never thought that the value would not match the full map
(defn read
[{:keys [state parser query] :as env} key params]
(let [st @state]
(if-let [[_ v] (find st key)]
(if (and query (map? v))
{:value (parser env query)}
{:value v})
{:value v}
{:value :not-found})))
but this is an incomplete implementation, you still have to deal with sequences
Hm so I had to implement all the parser and all it's funcs... That's low level. Why is om not responsible for that?
humm, sorry, maybe this doesn't work at all (the example)
but about your question, the Om design is to be open to any kind of database, not just clojure maps, one example is datascript
that's why I recommend fulcro, fulcro embraces the database as map, and implement a lot of plumbing that you would have to write yourself (and it's not trivial)
Oh okay... I thought the queries were passed as is.
All right
Since I'm using full clojure datomic that's easy to choose
Thanks
no problem 😉
mind blown... holy cow great blog post!
the code style is beautiful
thanks 🙂