Star

Created With

linkClauses

The QueryBuilder class supports all Neo4j clauses. They are used when adding parameters to the QueryBuilder instance (i.e. by calling the parameter methods), in order to generate the intended statement.

Each of them is an attribute of the QueryBuilderParameters type. A union of them is the QueryBuilderParameters['ParameterI'] type.

The final statement will consist of all the given clauses, in the order they are given.

example:

1linkconst queryBuilder = new QueryBuilder()

2link .match({

3link identifier: 'n',

4link label: 'MyLabel',

5link where: {

6link status: 'active'

7link }

8link })

9link .orderBy({

10link identifier: 'n',

11link property: 'age',

12link direction: 'DESC'

13link })

14link .return('a');

15link

16linkconsole.log(queryBuilder.getStatement()); // MATCH (n:A { status: $status }) ORDER BY n.age DESC RETURN n

17linkconsole.log(queryBuilder.getBindParam().get()); // { status: 'active' }

linkRaw Clause

In case the intended statement cannot be added by using the supported clauses, a raw string can be included in the parameters.

1linkconst queryBuilder = new QueryBuilder().raw('MATCH (a:A) RETURN a');

2link

3linkconsole.log(queryBuilder.getStatement()); // MATCH (a:A) RETURN a

4linkconsole.log(queryBuilder.getBindParam().get()); // { }

ClausesRaw Clause

Introduction Getting Started

Modelschevron_right

Sessions and Transactions

Query Builderchevron_right
Query Runnerchevron_right

Bind Parameters

Where Parameters