Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

pass parameters to @cypher directives #58

Closed
jexp opened this issue Jun 16, 2018 · 3 comments
Closed

pass parameters to @cypher directives #58

jexp opened this issue Jun 16, 2018 · 3 comments

Comments

@jexp
Copy link
Contributor

jexp commented Jun 16, 2018

e.g.

users(id: ID, name: String, first: Int = 10, offset: Int = 0): [User] @cypher(statement:"MATCH (u:User:StackOverflow) RETURN u LIMIT $first+$offset SKIP $offset")

results in

WITH apoc.cypher.runFirstColumn("MATCH (u:User:StackOverflow) RETURN u LIMIT $first+$offset SKIP $offset", {}, True) AS x UNWIND x AS user
    RETURN user { .name ,questions: [(user)-[:POSTED]->(user_questions:Question{}) | user_questions { .title }][..3] } AS user SKIP 0 LIMIT 10
{ first: 10, offset: 0 }
@wheresrhys
Copy link

As an additioanl requirement, it would be powerful to be able to use these parameters to modify the underlying cypher, not just as parameters passed to the cypher e.g. to modify the depth of recursion allowed when traversing relationships

@JobinMathewP
Copy link

Is there any solution or hack for this?

@johnymontana
Copy link
Contributor

We were explicitly excluding first, offset, and orderBy parameters from being passed to the Cypher query as these were handled elsewhere, but I can see the value in having these available in the Cypher statement used in the directive.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants