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

Auto generating query code #113

Open
danielcompton opened this issue Nov 15, 2015 · 3 comments
Open

Auto generating query code #113

danielcompton opened this issue Nov 15, 2015 · 3 comments

Comments

@danielcompton
Copy link
Collaborator

The RethinkDB Java driver auto generates it's code from an advanced JSON spec of the RethinkDB query language. It should be possible to auto generate this code in Clojure too using macros.

Pros:

  • Easily stay up to date with the official releases
  • Always fully compliant with the latest ReQL spec

Cons:

  • Macro code may be complex
  • We may lose code completion using macros
  • Not sure how we get docstrings with this approach.
@arichiardi
Copy link
Contributor

This is very interesting and would be great to be able to compose the query using only data (maps?) or data + macro.

@danielcompton
Copy link
Collaborator Author

danielcompton commented Jul 4, 2016

You can already do this :) Run (r/db :mydb) and look at the output. Then run (-> (r/db :mydb) (r/table :mytable)). The query is built up as data, then converted into the JSON protobuf message that RethinkDB needs when you run it.

@arichiardi
Copy link
Contributor

Ah cool, but I was more thinking of doing it on the frontend (see other issue), rethinkdb queries look indeed very composable..

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

No branches or pull requests

2 participants