INNER CODE UNIT · Kotlin
Cypher31Generator
neo4j-graphql/neo4j-graphql · src/main/kotlin/org/neo4j/graphql/CypherGenerator.kt:51
class Cypher31Generator : CypherGenerator() {
fun projectMap(field: Field, variable: String, md: MetaData, ctx: GeneratorContext): String {
val selectionSet = field.selectionSet ?: return ""
return projectSelectionFields(md, variable, selectionSet, ctx).map{
val array = md.properties[it.first]?.type?.array ?: false
// todo fix handling of primitive arrays in graphql-java
if (array) {
"`${it.first}` : [x IN ${it.second} | x]"
} else {
if (it.second == attr(variable, it.first)) ".`${it.first}`"
else "`${it.first}` : ${it.second}"
}
}.joinNonEmpty(", ","`$variable` {","}")
}
interface Predicate {