Fork me on GitHub
#gratitude
<
2023-11-22
>
h0bbit02:11:53

Recently, I read through all the guides on the Pedestal website: http://pedestal.io/pedestal/0.7-pre/guides/hello-world.html. I believe they were written by @mtnygard and are maintained by @hlship. I learnt so much about how to write good Clojure code from these guides! — How to think about routing, How to separate concerns, How to write testable code! The guides were an absolute delight to read through. Thank you!

👀 3
gratitude 5
h0bbit02:11:45

Thank you @jpmonettas for #C03KZ3XT0CF 🙂 I didn’t think that my REPL experience could become sweeter, but boy was I wrong. Flow-Storm has made debugging an order of magnitude easier.

gratitude 11
❤️ 2
Martín Varela06:11:32

If you haven't yet, try combining it with @U1G869VNV’s Portal... it's a great, great combo!

h0bbit07:11:31

I’d love to see what Portal adds to Flow-Storm. I find myself only in the Flow-Storm UI. I’d love to see how Portal improves the experience

Martín Varela07:11:24

Well, the data inspection aspect of Portal is nicer than the one currently on Flowstorm. You can make it so that you tap a value on Flowstorm, and it shows up on Portal, for you to navigate it. You can do some other cool stuff on Portal (one thing I found super nice is that you can compose the portal submit function with some arbitrary processing, so for example I made it so that documents I keep on XTDB can be navigated in portal, so clicking anything that looks like a UUID, or corresponds to a key that I know maps to an id, takes me to that object in the DB, but the possibilities are endless, really)

Martín Varela07:11:24

I suspect you could eventually have a Portal instance in a webview inside Flowstorm, with a little hacking.

h0bbit07:11:30

^ Okay, this is really cool. I’m assuming this is using the datafy/nav protocols for making queries to flesh out the data. I’m using next-jdbc + PG, and I believe next-jdbc already has implementations of datafy/nav on the data it returns. I’ll check if Portal can help me get a “excel” style view of my data.

Martín Varela07:11:57

Yes, basically I do a walk/postwalk on the results, and reify Nav via meta-data

Martín Varela07:11:02

(defn fetch [coll k v]
  (if-let [xx (xt/entity (xt/db node) v)]
    (navify xx)
    v))

(def navigable-keywords #{:xt/id ,,,})

(defn navify[x]
  (walk/postwalk (fn[e]
                   (if (instance? clojure.lang.IObj e)
                     (with-meta e {'clojure.core.protocols/nav
                                   (fn[coll k v]
                                     (if (or (contains? navigable-keywords k)
                                             (uuid/uuidable? v))
                                       (fetch coll k v)
                                       (user/navify v)))})
                     e))
                 x))

🙌 2
Martín Varela07:11:18

node there is bound to an initialized instance of XTDB

Martín Varela07:11:31

you can make it neater, of course

Martín Varela07:11:32

and you could extend String to implement Nav as well (can't do it via meta-data, unfortunately)