orderByTyped
Description
orderByTyped
is a method that applies typesafe order to a query.
Signature
orderByTyped(
selection: KeyProxyCallback<Entity>,
order?: 'ASC' | 'DESC',
nulls?: 'NULLS FIRST' | 'NULLS LAST'
): SelectQueryBuilder<Entity>
Arguments
- selection: KeyProxyCallback<Entity>: The callback which selects fields of entity.
- order?: 'ASC' | 'DESC': Order direction. Default is 'ASC'.
- nulls?: 'NULLS FIRST' | 'NULLS LAST': NULLS ordering.
Usage
// same as `query.orderBy('user.updatedAt', 'DESC')`
query.orderByTyped(user => user.updatedAt, 'DESC')
// same as `query.addOrderBy('user.name', 'ASC')`
query.addOrderByTyped(user => user.name, 'ASC')