Skip to content
# Class: SqlSortInjector

Defined in: packages/core/src/transformers/SqlSortInjector.ts:11

SqlSortInjector injects sort conditions into a SelectQuery model, creating ORDER BY clauses based on provided sort conditions.

Constructors ​

Constructor ​

new SqlSortInjector(tableColumnResolver?): SqlSortInjector

Defined in: packages/core/src/transformers/SqlSortInjector.ts:14

Parameters ​

tableColumnResolver? ​

(tableName) => string[]

Returns ​

SqlSortInjector

Methods ​

removeOrderBy() ​

static removeOrderBy(query): SimpleSelectQuery

Defined in: packages/core/src/transformers/SqlSortInjector.ts:23

Removes ORDER BY clause from the given query.

Parameters ​

query ​

The SelectQuery to modify

string | SimpleSelectQuery

Returns ​

SimpleSelectQuery

The modified SimpleSelectQuery with ORDER BY clause removed


inject() ​

inject(query, sortConditions): SimpleSelectQuery

Defined in: packages/core/src/transformers/SqlSortInjector.ts:58

Injects sort conditions as ORDER BY clauses into the given query model. Appends to existing ORDER BY clause if present.

Parameters ​

query ​

The SelectQuery to modify

string | SimpleSelectQuery

sortConditions ​

SortConditions

A record of column names and sort conditions

Returns ​

SimpleSelectQuery

The modified SimpleSelectQuery

Released under the MIT License.