om

Please ask the channel first, not @dnolen directly!
wilkerlucio 2017-10-24T11:34:55.000015Z

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

🦜 3
gardnervickers 2017-10-24T15:46:30.000813Z

@wilkerlucio Very cool, have you thought about generating the parser index from clojure.spec fspec’s?

baptiste-from-paris 2017-10-24T15:47:13.000289Z

bravo !

wilkerlucio 2017-10-24T15:47:35.000290Z

@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

wilkerlucio 2017-10-24T15:48:06.000780Z

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

vinnyataide 2017-10-24T17:48:50.000135Z

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"}}

vinnyataide 2017-10-24T17:59:42.000437Z

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})))

wilkerlucio 2017-10-24T19:06:40.000569Z

@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

wilkerlucio 2017-10-24T19:06:59.000122Z

see that at {:value v} you are returning the full :navbar, so that's what you see in your response

wilkerlucio 2017-10-24T19:08:43.000359Z

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

wilkerlucio 2017-10-24T19:09:09.000418Z

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

wilkerlucio 2017-10-24T19:10:47.000319Z

but just as a heads up, I think with this code your parser would work (for this case you mentioned at least):

vinnyataide 2017-10-24T19:10:49.000042Z

@wilkerlucio I'll definitely look at your parser article. Never thought that the value would not match the full map

wilkerlucio 2017-10-24T19:10:49.000422Z

(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})))

wilkerlucio 2017-10-24T19:11:10.000350Z

but this is an incomplete implementation, you still have to deal with sequences

vinnyataide 2017-10-24T19:13:37.000384Z

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?

wilkerlucio 2017-10-24T19:13:48.000092Z

humm, sorry, maybe this doesn't work at all (the example)

wilkerlucio 2017-10-24T19:14:06.000375Z

but about your question, the Om design is to be open to any kind of database, not just clojure maps, one example is datascript

wilkerlucio 2017-10-24T19:14:32.000550Z

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)

vinnyataide 2017-10-24T19:14:50.000274Z

Oh okay... I thought the queries were passed as is.

vinnyataide 2017-10-24T19:14:59.000301Z

All right

vinnyataide 2017-10-24T19:15:27.000394Z

Since I'm using full clojure datomic that's easy to choose

vinnyataide 2017-10-24T19:15:30.000370Z

Thanks

wilkerlucio 2017-10-24T19:16:07.000384Z

no problem 😉

vinnyataide 2017-10-24T20:27:13.000306Z

mind blown... holy cow great blog post!

vinnyataide 2017-10-24T20:29:22.000430Z

the code style is beautiful

wilkerlucio 2017-10-25T09:10:03.000219Z

thanks 🙂

ag 2017-10-24T21:08:48.000009Z

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