Query Builder

To get the query builder:

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

.createAlias()

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.

queryBuilder.createAlias('a');

.crossJoin()

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

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

.fullOuterJoin()

Performs a full outer join.

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

.getQuery()

Gets an instance of the query class.

queryBuilder.getQuery();

.groupBy()

Sets the group by.

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

.having()

Sets the having clause.

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

.innerJoin()

Performs an inner join.

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

.insert()

Signals an insert.

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

.makeJoin()

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');

.leftJoin()

Performs Performs a left join.

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

.leftOuterJoin()

Performs a left outer join.

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

.limit()

Sets the limit.

queryBuilder.limit(10);

.offset()

Sets the offset.

queryBuilder.offset(10);

.orderBy()

Sets the order by.

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

.outerJoin()

Performs an outer join.

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

.prepare()

Makes sure all changes have been applied to the query.

queryBuilder.prepare();

.remove()

Signals a delete.

queryBuilder.remove();

.rightJoin()

Performs a right join.

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

.from()

Provide a derived table to select from.

usersQueryBuilder.where(criteria).groupBy('foo');

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

.rightOuterJoin()

Performs a right outer join.

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

.select()

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

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

.update()

Signals an update.

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

.where()

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 ""