INNER CODE UNIT · Kotlin

CypherGenerator

neo4j-graphql/neo4j-graphql · src/main/kotlin/org/neo4j/graphql/CypherGenerator.kt:8

abstract class CypherGenerator {
    companion object {
        val VERSION = Version.getNeo4jVersion()
        val DEFAULT_CYPHER_VERSION = "3.4"

        fun instance(): CypherGenerator {
            return Cypher31Generator()
        }
        fun attr(variable: String, field: String) = "`$variable`.`$field`"

        fun isPlural(name: String) = name.endsWith("s")

        fun singular(name: String) = name.substring(0, name.length - 1)

        fun formatAnyValue(value: Any?): String =
                when (value) {
                    null -> "null"
                    is String -> if (isParam(value)) value else "\"${value}\""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…