Neo4jGraphQL
constructor
Returns a Neo4jGraphQL
instance.
Takes an input
object as a parameter, the supported fields of which are described below.
Input
Accepts all of the options from makeExecutableSchema
, plus the additional arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Could be used for configure/enable/disable specific features. |
Neo4jFeaturesSettings
Name and Type | Description |
---|---|
|
Additional configuration for filters. |
Neo4jFiltersSettings
Name and Type | Description |
---|---|
|
Additional configuration for String filters. |
|
Additional configuration for String filters. |
getSchema
An asynchronous method that generates the GraphQL schema to be used in a server. The result is memoized, so if this is called twice, the schema is only generated once.
checkNeo4jCompat
Asynchronous method to check the compatibility of the specified DBMS, that either resolves to void
in a successful scenario, or throws an error if the database is not compatible with the Neo4j GraphQL Library.
Takes an input
object as a parameter, the supported fields of which are described below.
Example
Given any valid type definitions saved to the variable typeDefs
and a valid driver instance saved to the variable driver
, the following will confirm database compatibility:
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
await neoSchema.checkNeo4jCompat();
Input
Accepts the arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Additional driver configuration options. |
assertIndexesAndConstraints
Asynchronous method to assert the existence of database constraints, that either resolves to void
in a successful scenario, or throws an error if the necessary constraints do not exist following its execution.
Takes an input
object as a parameter, the supported fields of which are described below.
Example
Given the following type definitions saved to the variable typeDefs
and a valid driver instance saved to the variable driver
:
type Book {
isbn: String! @unique
}
And the construction of a Neo4jGraphQL
, using:
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
const schema = await neoSchema.getSchema();
The following will check whether a unique node property constraint exists for label "Book" and property "isbn", and throw an error if it does not:
await neoSchema.assertIndexesAndConstraints();
The next example will create the constraint if it does not exist:
await neoSchema.assertIndexesAndConstraints({ options: { create: true } });
Input
Accepts the arguments below:
Name and Type | Description |
---|---|
|
An instance of a Neo4j driver. |
|
Additional driver configuration options. |
|
Options for the execution of |