You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val schema =
"""
type Person {
name: ID!
age: Int
}
# Optional if you use generated queries
type Query {
person : [Person]
}"""
val query = """ quero { person { age } } """
val schema = SchemaBuilder.buildSchema(idl)
val ctx = QueryContext()
val (cypher, params) = Translator(schema).translate(query, mapOf(), ctx)
// generated Cypher
cypher == "MATCH (p:Person) WHERE p.name = $pName RETURN p {.age} as p"
but i get an error about GraphQLDefaultValueArgument,
I would like to know if I am doing something wrong and if this library can be used solely to translate graphql queries into cypher queries.
The text was updated successfully, but these errors were encountered:
packagedemoimportorg.neo4j.graphql.QueryContextimportorg.neo4j.graphql.SchemaBuilderimportorg.neo4j.graphql.Translatorfunmain() {
val idl =""" type Person { name: ID! age: Int } # Optional if you use generated queries type Query { person : [Person] }""".trimIndent()
val query =""" query { person { age } } """val schema =SchemaBuilder.buildSchema(idl)
val ctx =QueryContext()
val (cypher) =Translator(schema).translate(query, mapOf(), ctx).first()
// prints: MATCH (person:Person) RETURN person { .age } AS personprintln(cypher)
}
I tried this code example:
val schema =
"""
type Person {
name: ID!
age: Int
}
# Optional if you use generated queries
type Query {
person : [Person]
}"""
val query = """ quero { person { age } } """
val schema = SchemaBuilder.buildSchema(idl)
val ctx = QueryContext()
val (cypher, params) = Translator(schema).translate(query, mapOf(), ctx)
// generated Cypher
cypher == "MATCH (p:Person) WHERE p.name = $pName RETURN p {.age} as p"
but i get an error about GraphQLDefaultValueArgument,
I would like to know if I am doing something wrong and if this library can be used solely to translate graphql queries into cypher queries.
The text was updated successfully, but these errors were encountered: