This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-04
Channels
- # announcements (8)
- # beginners (27)
- # calva (8)
- # cider (26)
- # clara (19)
- # cljdoc (4)
- # cljsjs (1)
- # clojure (221)
- # clojure-dev (6)
- # clojure-europe (11)
- # clojure-gamedev (18)
- # clojure-italy (8)
- # clojure-nl (12)
- # clojure-spec (85)
- # clojure-uk (17)
- # clojurescript (34)
- # community-development (1)
- # cursive (26)
- # datomic (16)
- # dirac (19)
- # duct (6)
- # editors (4)
- # figwheel-main (1)
- # fulcro (68)
- # graphql (41)
- # juxt (16)
- # luminus (11)
- # off-topic (30)
- # pathom (35)
- # planck (2)
- # re-frame (18)
- # reagent (20)
- # remote-jobs (6)
- # rum (1)
- # shadow-cljs (37)
- # spacemacs (9)
- # vim (14)
are there any utilities to create and run transactions directly against the pathom parser (without fulcro or so, directly from background tasks? I still absolutely hate the use of lists and symbols in transactions 😞
(defn create-request
[{::env/keys [graph] :as ctx}]
(let [tx-id
`m/create
query
`[(~tx-id {})]
order-id
(-> (graph ctx query)
(get tx-id)
(get ::m/order-id))]
;; use order-id ...
))
I can easily abstract that myself and call something like (transact! env 'm/create {])
but was just wondering if there is something like that maybe?
@thheller nothing from standard lib, mainly because was never a use case for me, so better to create your own wrapper since you want a concise way to call it 👍
do you only use the graph API from fulcro? I sort of started using it everything and except for the somewhat clunky API I really like that
@thheller what you mean use the graph api from fulcro?
ah, just read the only
, currently yeah, but I keep feeling like it would be useful in more contexts
I was thinking making very trivial ways to create/run parsers
you mean cluncky to call the parser?
no calling the parser is easy. clunky in that I have to unwrap the results and stuff
for the parallel we need to do the channel read, for the sync one are you having to do some post processing too?
cool, just out of curiosity, in which contexts are you using tha parser, like replacing regular logic in the program?
I used to do straight db interop on the server but trying to do everything through the parser so its easier to trigger and monitor
makes sense, for those usages I do the same, any operations are first implemented in the parser and then used from it.
but I keep seeing these same patterns in my regular logic, I have some data, it maybe need a few steps to get the data I need, and I keep writing in the regular clojure style, which means I have to remember all the steps
so I wonder what would look like if the parser was a more integral part of my code, delegating all the data transitions to it
its technically valid, but I never tried doing it, I saw people doing similar things in GraphQL, I think its an interesting way to do things, could even operate on lists
something like:
[{:customer/all-tags [(customer.tag/delete)]}]
@thheller I did a quick run just for fun, it works already (kind of) 🙂
(pc/defresolver people-resolver [env _]
{::pc/output [{:people [:person/name]}]}
{:people [{:person/name "Tom"}
{:person/name "Tal"}
{:person/name "Lita"}]})
(pc/defmutation do-something [env input]
{}
(println "DO SOMETHING" input (p/entity env))
{})
(parser {} [{:people [:person/name `(do-something)]}])
DO SOMETHING {} #:person{:name Tom}
DO SOMETHING {} #:person{:name Tal}
DO SOMETHING {} #:person{:name Lita}
=>
{:people [{:person/name "Tom", com.wsscode.pathom.playground/do-something {}}
{:person/name "Tal", com.wsscode.pathom.playground/do-something {}}
{:person/name "Lita", com.wsscode.pathom.playground/do-something {}}]}
there is no auto-link between the mutation params and input, you need to grab it from the entity, but that can be easely automated