Skip to content
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

Database functions? #28

Open
Mori opened this issue Dec 16, 2012 · 2 comments
Open

Database functions? #28

Mori opened this issue Dec 16, 2012 · 2 comments

Comments

@Mori
Copy link

Mori commented Dec 16, 2012

How do you use database functions / transaction functions written in ruby, via diametric?

@avescodes
Copy link
Contributor

As far as I know it is not possible to use database functions written in Ruby at the moment (at least in the REST persistence API.) (Unless @yokolet has made the enhancement in the last few weeks).

Honestly I'm not sure if the Datomic REST API even exposes this functionality. It would certainly be possible to implement it in Peer-mode, but REST is always another story (as it is with most "lower-level" features of Datomic).

@yokolet
Copy link
Contributor

yokolet commented Dec 17, 2012

Hello @Mori . Thanks for trying Diametric out.

You can use database function on diametric. But, it is not straightforward in this version. It will be something like below.

If you are using peer connection:

query = [Java::Datomic::Util.list(":db.fn/retractEntity", dbid)]
Peer.class.connection.transact(query).get

If you are using rest connection:

query = [[:"db.fn/retractEntity", dbid.to_i]]
REST.class.transact(query)

I used the function to delete an entity in Diametric. Perhaps, you can use functions like this, but I haven't tried yet from a program that uses Diametric. So, if you have a chance, try this and report the result. Your attempt will help other users as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants