Query Builder

To get the query builder:

let queryBuilder = wetland.getManager().getRepository(Entity).getQueryBuilder();


Creates an alias for an entity. This method is used by .join() to create an alias for the join column. To create an alias we recommend you to pass it directly on the .getQueryBuilder() method.



Performs a cross join. Takes the column name the fist argument and the target alias as the second argument.

queryBuilder.crossJoin('columnName', 'a');


Performs a full outer join.

queryBuilder.fullOuterJoin('columnName', 'a');


Gets an instance of the query class.



Sets the group by.

queryBuilder.groupBy(['name', 'age']);


Sets the having clause.

queryBuilder.having({'name': {lte: 12}});
queryBuilder.having({'name': {gte: 10, lte: 50}});


Performs an inner join.

queryBuilder.innerJoin('columnName', 'a');


Signals an insert.

queryBuilder.insert({name: 'Wesley'});


Performs a join. This method is used by specific join methods in this class and we recommend you to use them instead.

queryBuilder.makeJoin('innerJoin', 'columnName', 'a');


Performs Performs a left join.

queryBuilder.leftJoin('columnName', 'a');


Performs a left outer join.

queryBuilder.leftOuterJoin('columnName', 'a');


Sets the limit.



Sets the offset.



Sets the order by.

queryBuilder.orderBy('name', 'desc');
queryBuilder.orderBy({name: 'desc'});
queryBuilder.orderBy(['name', {age: 'asc'}]);


Performs an outer join.

queryBuilder.outerJoin('columnName', 'a');


Makes sure all changes have been applied to the query.



Signals a delete.



Performs a right join.

queryBuilder.rightJoin('columnName', 'a');


Provide a derived table to select from.


queryBuilder.from(usersQueryBuilder, 'a_derived').select({count: '*'});


Performs a right outer join.

queryBuilder.rightOuterJoin('columnName', 'a');


Select columns. Giving it an alias or the column name equals to SELECT *.

queryBuilder.select({sum: 'age'});


Signals an update.

queryBuilder.update({name: 'Wesley'});


Sets the where clause.

queryBuilder.where({name: 'Wesley'});
queryBuilder.where({name: ['Wesley', 'Raphaela']});
queryBuilder.where({name: 'Wesley', company: 'SpoonX', age: {gt: 25}});

results matching ""

    No results matching ""