ReturningColumn
Represents one column requested in a RETURNING clause, with an optional alias.
ReturningQuery#returning() builds ReturningColumn instances internally for every string you
pass. Extends BaseField. Not to be confused with
ReturningQuery — that's the base class Insert/Update extend to gain
.returning(); this is the individual column element it produces.
Constructor
ReturningColumn(field: string): ReturningColumn
new ReturningColumn(field: string): ReturningColumn
Dual-callable. field must match field[ [as] alias] — anything else throws a TypeError
("does not match returning column format"). Unlike Field, it does not accept a
schema/table qualifier.
import { Insert } from '@sqb/builder';
Insert('customers', { name: 'Jane' }).returning('id', 'name as full_name');
// ... returning id, name as full_name
Properties
| Key | Type | Readonly | Description |
|---|---|---|---|
_type | SerializationType.RETURNING_COLUMN | Yes | Discriminates this node during serialization. |
_field | string | No | The column name. |
_alias | string | undefined | No | Alias, if present in field. |
Plus everything inherited from BaseField (_schema/_table are unused —
ReturningColumn never parses a qualifier).
Methods
ReturningColumn has no chainable methods — it exposes only its serialization logic. As a side
effect, serializing a ReturningColumn pushes { field, alias } onto the active
SerializeContext's returningFields array, which surfaces on
GenerateResult.returningFields. Reserved words in
_field/_alias are escaped (double-quoted) automatically.