Skip to content

Commit d13cd5c

Browse files
authored
Merge pull request #132 from neo4j/110-cypher-directive-documentation-improvements
Add an example for using input arguments with cypher
2 parents dec9480 + b073c4b commit d13cd5c

File tree

1 file changed

+21
-1
lines changed
  • modules/ROOT/pages/type-definitions/directives

1 file changed

+21
-1
lines changed

modules/ROOT/pages/type-definitions/directives/cypher.adoc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ type Query {
154154

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

157+
== Input arguments
158+
The `@cypher` statement can access the query parameters by prepending `$` to the parameter name. For example:
159+
160+
[source, graphql, indent=0]
161+
----
162+
type Query {
163+
name(value: String): String @cypher(statement: "RETURN $value AS res", columnName: "res")
164+
}
165+
----
166+
167+
The following GraphQL query returns the parameter `value`:
168+
169+
[source, graphql, indent=0]
170+
----
171+
query {
172+
name(value: "Jane Smith")
173+
}
174+
----
175+
176+
157177
== Usage examples
158178

159179
The `@cypher` directive can be used in different contexts, such as the ones described in this section.
@@ -234,4 +254,4 @@ type Mutation {
234254
columnName: "a"
235255
)
236256
}
237-
----
257+
----

0 commit comments

Comments
 (0)