# buildNeo4jResolvers

## API Reference

* `typeDefs` (required): Your GraphQL type definitions in [SDL format](https://www.prisma.io/blog/graphql-sdl-schema-definition-language-6755bcb9ce51/). <br>
* `resolvers`(required): A resolvers object to augment. <br>
* `query` (default: `true`): A Boolean controlling whether to generate resolvers for query types. <br>
* `mutation` (default: `true`): A Boolean controlling whether to generate resolvers for mutation types. <br>
* `bindingKey` (default: 'neo4j') The key of the binding (stored in your server's context object) to be used within generated resolvers for operation delegation.

## Example

```javascript
import { buildNeo4jResolvers } from 'neo4j-graphql-binding';
​
const typeDefs = `
  type Technology @model {
    name: String! @unique
    integration: [Technology] @relation(name: "HAPPINESS", direction: OUT)
    integrationCount: Int @cypher(statement: """ 
      MATCH (this)-[:HAPPINESS]->(t:Technology)
      RETURN count(t)
    """)
  }
  type Query {
    Technology: [Technology] @cypher(statement: """
      MATCH (t:Technology) RETURN t
    """)
  }
  type Mutation {
    deleteTechnology(id: ID!): Boolean @cypher(statement: """
      MATCH (t: Technology {id: $id})
      DETACH DELETE t
      RETURN TRUE
    """)
  }
  schema {
    query: Query
    mutation: Mutation
  }
`;
​
const augmented = buildNeo4jResolvers({
  typeDefs: typeDefs,
  driver: driver
});
```

For every `query` or `mutation` type using a `@cypher` directive, or for those generated by `buildNeo4jTypeDefs`, a resolver will be created if one is not provide&#x64;*.*

```javascript
Query: {
  Technology: (obj, params, ctx, info) => {
    return ctx.neo4j.query.Technology(params, info);
  }
},
Mutation: {
  createTechnology: (obj, params, ctx, info) => {
    return ctx.neo4j.mutation.createTechnology(params, info);
  },
  deleteTechnology: (obj, params, ctx, info) => {
    return ctx.neo4j.mutation.deleteTechnology(params, info);
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://neo4j-graphql-server.gitbook.io/docs/neo4j-graphql-binding/buildneo4jresolvers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
