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

Implement r.pathspec(...) #16

Closed
NotJustAnna opened this issue Feb 15, 2020 · 2 comments · Fixed by #7
Closed

Implement r.pathspec(...) #16

NotJustAnna opened this issue Feb 15, 2020 · 2 comments · Fixed by #7
Assignees
Labels
enhancement New feature or request

Comments

@NotJustAnna
Copy link
Member

NotJustAnna commented Feb 15, 2020

This issue is a continuation of rethinkdb/rethinkdb#5007

Implement the discussed at the issue.

From the original issue:

Right now pathspecs are kind hairy due to Java's lack of nice hashmap and List literals:

in javascript:

r.table('foo').filter({x: {y: {z: "bar"}}})

turns into the java query:

r.table("foo").filter(r.hashMap("x", r.hashMap("y", r.hashMap("z", "bar"))))

Since depth-first is more common in path-specs than breadth first, it might make sense to have a special r.pathspec convenience that creates the appropriate hashmap structure. It might look something like:

r.table("foo").filter(r.pathspec("x", "y", "z", "bar"))

I haven't really thought about branching pathspecs too much, maybe there's no syntax that would work well. It's something to think about.

@NotJustAnna NotJustAnna added the enhancement New feature or request label Feb 15, 2020
@NotJustAnna
Copy link
Member Author

Implemented in develop/experimental (#7)

@NotJustAnna NotJustAnna linked a pull request Feb 15, 2020 that will close this issue
@NotJustAnna NotJustAnna self-assigned this Feb 17, 2020
@NotJustAnna
Copy link
Member Author

To be documented:

The best way to solve the breadth problem is pathspec with object:

r.table("foo").filter(
    r.object("x1", r.pathspec("y", "z", "bar"), "x2", r.pathspec("y", "z", "bar")
)

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

Successfully merging a pull request may close this issue.

1 participant