neo4j-graphql / neo4j-graphql-java

Neo4j Labs Project: Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support to auto generate IDs

Andy2003 opened this issue · comments

Support an @autogenerate directive which assigns an UUID on creation.

Schema would look like:

type Movie {
    id: ID! @autogenerate
    name: String!
}

GraphQL input:

mutation {
    createMovies(input: [{ name: "dan" }]) {
        movies {
            id
            name
        }
    }
}

Generated cypher

CALL {
  CREATE (this0:Movie)
  SET this0.id = randomUUID()
  SET this0.name = $this0_name
  RETURN this0
}

RETURN this0 { .id, .name } AS this0