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
QueryBuilderParameters['MergeI']
A literal string will be used as is.
1linkconst queryBuilder = new QueryBuilder()
2link .where('a.id = 5'); /* --> literal string to use */
3link
4linkconsole.log(queryBuilder.getStatement()); // WHERE a.id = 5
5linkconsole.log(queryBuilder.getBindParam().get()); // {}
An object of the type WhereParamsByIdentifierI
can be used.
1linkconst queryBuilder = new QueryBuilder().where({
2link identifier1: {
3link id: '20'
4link },
5link identifier2: {
6link id: '21',
7link age: 28
8link }
9link});
10link
11linkconsole.log(queryBuilder.getStatement()); // WHERE identifier1.id = $id AND identifier2.id = $id__aaaa AND identifier2.age = $age
12linkconsole.log(queryBuilder.getBindParam().get()); // { id: '20', id__aaaa: '21', age: 28 }
A Where instance can be used. In this case, the return value of its .getStatement('text')
method will be used.
1linkconst existingWhereInstance = new Where({
2link identifier1: {
3link id: '20'
4link },
5link identifier2: {
6link id: '21',
7link age: 28
8link }
9link});
10linkconst queryBuilder = new QueryBuilder(
11link /* --> for expected behavior, the Where instance and the QueryBuilder instance should use the same BindParam */
12link existingWhereInstance.getBindParam()
13link).where(existingWhereInstance);
14link
15linkconsole.log(queryBuilder.getStatement()); // WHERE identifier1.id = $id AND identifier2.id = $id__aaaa AND identifier2.age = $age
16linkconsole.log(queryBuilder.getBindParam().get()); // { id: '20', id__aaaa: '21', age: 28 }
A Literal String can be used at Where conditions, when the typing supports it.