Overview Defining a Model Instances Creating Nodes and Relationships Merging Nodes and Relationships Updating Nodes and Relationships Deleting Nodes Deleting Relationships Finding Nodes and Relationships Hooks Temporary Databases
A literal string will be used as is.
1linkconst queryBuilder = new QueryBuilder()
2link .orderBy('a ASC, b'); /* --> literal string to use */
3link
4linkconsole.log(queryBuilder.getStatement()); // ORDER BY a ASC, b
5linkconsole.log(queryBuilder.getBindParam().get()); // {}
The literal strings will be joined with a comma.
1linkconst queryBuilder = new QueryBuilder()
2link .orderBy(['a ASC', 'b']); /* --> literal strings to use */
3link
4linkconsole.log(queryBuilder.getStatement()); // ORDER BY a ASC, b
5linkconsole.log(queryBuilder.getBindParam().get()); // {}
An object with an identifier, and an optional property and direction can be used.
1linkconst queryBuilder = new QueryBuilder().orderBy({
2link /* --> identifier/name to use for ordering */
3link identifier: 'a',
4link /* --> (optional) the property of the identifier to order by */
5link property: 'name',
6link /* --> (optional) the direction to orde by */
7link direction: 'DESC', // --> 'ASC' or 'DESC'
8link});
9link
10linkconsole.log(queryBuilder.getStatement()); // ORDER BY a.name DESC
11linkconsole.log(queryBuilder.getBindParam().get()); // {}
An array can be used with any combination of: a string literal, an array with identifier/direction, and an object.
1linkconst queryBuilder = new QueryBuilder().orderBy([
2link /* --> literal string */
3link 'a',
4link /* --> identifier/direction tuple */
5link ['b', 'DESC'], // -> 'ASC' or 'DESC',
6link {
7link /* --> an object, as defined above */
8link identifier: 'c',
9link property: 'age',
10link }
11link]);
12link
13linkconsole.log(queryBuilder.getStatement()); // ORDER BY a, b DESC, c.age
14linkconsole.log(queryBuilder.getBindParam().get()); // {}