OrderColumn
Represents one ORDER BY column, optionally schema/table-qualified, with an ascending/descending
direction. Select#orderBy() builds OrderColumn instances internally for every string you pass.
Extends BaseField.
Constructor
OrderColumn(value: string): OrderColumn
new OrderColumn(value: string): OrderColumn
Dual-callable. value must match
[+|-][[schema.]table.]field[ (asc|dsc|desc|ascending|descending)] (case-insensitive suffix) —
anything else throws a TypeError ("does not match order column format"). A leading - or a
dsc/desc/descending suffix sets _descending; a leading + or an asc/ascending suffix
(or no suffix at all) leaves it ascending.
import { Select } from '@sqb/builder';
Select().from('customers').orderBy('-created_at', 'name asc', '+id');
// ... order by created_at desc, name, id
Properties
| Key | Type | Readonly | Description |
|---|---|---|---|
_type | SerializationType.ORDER_COLUMN | Yes | Discriminates this node during serialization. |
_field | string | No | The unqualified column name. |
_table | string | undefined | No | Table qualifier, if present in value. |
_schema | string | undefined | No | Schema qualifier, if present in value. |
_descending | boolean | No | Whether to render a trailing desc. |
Plus everything inherited from BaseField.
Methods
OrderColumn has no chainable methods — it exposes only its serialization logic. Reserved words
in _field are escaped (double-quoted) automatically when serialized.