parseOrderByExpression

Function: parseOrderByExpression()

ts
function parseOrderByExpression(orderBy): ParsedOrderBy[];
function parseOrderByExpression(orderBy): ParsedOrderBy[];

Defined in: packages/db/src/query/expression-helpers.ts:265

Parses an ORDER BY expression into a simple array of sort specifications.

Parameters

orderBy

The ORDER BY expression array

OrderBy | null | undefined

Returns

ParsedOrderBy[]

Array of parsed order by specifications

Example

typescript
const sorts = parseOrderByExpression(orderBy)
// Returns: [
//   { field: ['category'], direction: 'asc', nulls: 'last' },
//   { field: ['price'], direction: 'desc', nulls: 'last' }
// ]
const sorts = parseOrderByExpression(orderBy)
// Returns: [
//   { field: ['category'], direction: 'asc', nulls: 'last' },
//   { field: ['price'], direction: 'desc', nulls: 'last' }
// ]
Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.