$ open source · GPL-3.0 — need a commercial license? imqueue.com →

OrderByInput class

Which columns to order by, and in which direction.

Signature:

export declare class OrderByInput 

Remarks

Keyed by column name; query.toOrderOptions turns it into Sequelize's order array, preserving the key order of the object, so the first key is the primary sort.

Direction values are coerced rather than validated: anything that does not read as desc, case-insensitively, becomes ascending. That is deliberate — the value arrives from a remote caller and ends up in SQL, so an unrecognised direction has to become a safe default rather than being passed through. It does mean a typo silently sorts the other way.

Column names are NOT coerced, and they reach the query as given.

Example

const orderBy: OrderByInput = { type: OrderDirection.asc, createdAt: OrderDirection.desc };