-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to call arbitrary database function with payload #75
Comments
Your request makes a lot of sense. There's one wrinkle to consider, which is that the payload can contain multiple entities. It would be necessary for every entity to go through the same db fn, so the transaction might look more like this:
|
Also, if your need is urgent, it is possible for you to supply a new literal of your own to invoke db fns. The steps would be:
Vase is open to extension precisely so you can define your own tags and use them in a descriptor file. |
Hi @ivarref - Thanks for using Vase and reaching out with your request! Originally, At the time, the rationale was that if a user wanted more specific control over DB interactions, they were better off creating a new action literal for their use-case, or creating the transaction data within a All of that said, the Vase team will talk about opening |
Update Whoops. Seems the error below was a REPL-only thing. Loading works fine using the default Vase server. Comment Thanks for the input. Original comment Hi @mtnygard and @ohpauleez and thank you for your input. I've given @mtnygard 's suggestion a go with a custom reader, but encountered a new problem. Given the following edn file:
gives the following error in the REPL:
I'm not sure exactly what's going wrong. This style (the #db/fn part) works fine inside a clj file. Do you have any suggestions or clues about how to fix this? Regards |
I've added a sample project that adds this functionality as suggested by @mtnygard if others are interested: https://gitlab.nsd.uib.no/ire/vase-transact-fn The edn file looks like this:
|
I could probably write a pull request adding #vase/transact-fn with this functionality if that would be of interest? @mtnygard @ohpauleez |
It has always been our goal to support and foster a community around the creation/sharing of extensions and action literals for Vase. It's unlikely that we'll add anymore action literals to the core of Vase (there are a few we've been considering, but haven't committed to), but we are going to open up Thanks for opening this issue, starting the conversation back up, and creating an action literal that solves the problem! It is great to see the community jump in! |
Hi, and thanks for a fine library.
Currently it does not seem easy to call an arbitrary database function on the given JSON payload.
I would like the following possibility:
and that this should expand to:
It is then up to
:my-great-fn
to generate / expand to the proper data as needed.I think this is preferable over using custom interceptors with
request db
orrequest conn
as this will preserve ACID properties.Would this be possible and desirable to add to Vase?
Regards
The text was updated successfully, but these errors were encountered: