Skip to main content

applyOrder

Description​

applyOrder is a method that applies order to a query.

Signature​

applyOrder(
orderBy: OrderParam<Entity>,
orderOptions?: ApplyOrderOptions
): SelectQueryBuilder<Entity>

Arguments​

A field that is a @CalculatedColumn of the alias (tableAlias, alias, or the main one) is ordered by its value, as orderByTyped does; select it with addSelectCalculated first, or it throws a TypeError.

Usage​

query.applyOrder({ field: 'name', direction: 'asc', nulls: 'last' }, { useQuotes: true })