This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-22
Channels
- # architecture (9)
- # beginners (90)
- # cider (98)
- # cljs-dev (23)
- # cljsrn (4)
- # clojure (101)
- # clojure-brasil (3)
- # clojure-dev (48)
- # clojure-italy (15)
- # clojure-losangeles (3)
- # clojure-russia (12)
- # clojure-uk (17)
- # clojured (1)
- # clojurescript (141)
- # community-development (15)
- # core-async (1)
- # datascript (12)
- # datomic (18)
- # docker (3)
- # emacs (1)
- # events (1)
- # figwheel (1)
- # fulcro (57)
- # graphql (4)
- # javascript (9)
- # jobs (1)
- # lein-figwheel (1)
- # leiningen (1)
- # lumo (1)
- # off-topic (68)
- # om (9)
- # om-next (3)
- # onyx (4)
- # parinfer (6)
- # pedestal (14)
- # portkey (2)
- # proton (1)
- # protorepl (19)
- # re-frame (57)
- # reagent (46)
- # ring-swagger (12)
- # shadow-cljs (167)
- # slack-help (5)
- # specter (18)
- # sql (1)
- # uncomplicate (3)
- # unrepl (1)
I'd like to float an idea; in a bit of work I'm doing internally, we have a object type ... let's call it Widget
. For a Widget
most of the data comes from our primary database but if certain selections are made, we go get data from a secondary source and merge it in.
So that's cool, and I have a resolver function that does just that: grabs the :widget
key from a parent map, checks the selections, and maybe merges in the extra data.
BUT I have many objects that contain a :widget
key. Fortunately, they are uniform in calling it :widget
.
So what I'm thinking is: how about allowing a :resolve directly on an Object to localize this kind of logic? The :resolve in this case would be more like a filter .. it would be passed the value and would resolve the same value, modified as necessary. In my case, the value passed in would be the raw Widget
and would resolve to the same, or the Widget
merged with that external data.
I'm trying to think about how this might be abused, cause unexpected problems, break existing code, or cause performance issues.
@hlship seems right can maybe also be used for cashing, like get something from cash, when some conditions are met, get from database?