Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion modules/ROOT/pages/type-definitions/directives/cypher.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ type Query {

The downside of the latter approach is that you need to adjust the return object as you change your object type definition.

== Input arguments
The `@cypher` statement can access the query parameters by prepending `$` to the parameter name. For example:

[source, graphql, indent=0]
----
type Query {
name(value: String): String @cypher(statement: "RETURN $value AS res", columnName: "res")
}
----

The following GraphQL query returns the parameter `value`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the parameter name or value? i think i'm confused

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'm trying to reference the parameter (value) passed to the query (name).


[source, graphql, indent=0]
----
query {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another point of confusion on my part: how does this query relate to the query above with the cypher directive in it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this query we are passing a parameter called value that is caught by the @cypher directive (see the $value)

name(value: "Jane Smith")
}
----


== Usage examples

The `@cypher` directive can be used in different contexts, such as the ones described in this section.
Expand Down Expand Up @@ -234,4 +254,4 @@ type Mutation {
columnName: "a"
)
}
----
----