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 🙂
hey guys, I'd like to send a remote query, that serves a file. e.g. csv. How can I do it without using a specialized remote? Meaning how can I use existing scaffolding that works for "tabular" data, but this time instead of returning {:value data ,, etc.
I'd love to serve .csv file