Skip to main content

BaseField

Abstract base for every "column reference" element — Field, GroupColumn, OrderColumn, and ReturningColumn all extend it. It only defines the common shape (schema/table/field parts plus a couple of optional hints); parsing the source string and serializing to SQL is left entirely to each subclass.

BaseField cannot be instantiated directly; calling BaseField() or new BaseField() throws a TypeError ("BaseField is abstract and cannot be instantiated"). You always work with one of its concrete subclasses.

Constructor

BaseField(): BaseField
new BaseField(): BaseField

Dual-callable, no-argument constructor, guarded against direct instantiation as described above. A subclass calls it via BaseField.call(this) before parsing its own arguments.

Properties

KeyTypeReadonlyDescription
_fieldstringNoThe unqualified field name (or *). Initialized to '' by the base constructor; subclasses parse and overwrite it.
_schemastring | undefinedNoSchema qualifier, if the subclass parsed one.
_tablestring | undefinedNoTable qualifier, if the subclass parsed one.
_dataTypeDataType | undefinedNoOptional data type hint (used by Field).
_isArrayboolean | undefinedNoOptional array-field hint (used by Field).
_isDataSetboolean | undefinedNoDeclared on the shape but not read or set by any constructor in @sqb/builder itself.
_descendingboolean | undefinedNoSort direction hint (used by OrderColumn).

BaseField does not itself implement _type or _serialize() — every subclass supplies its own.

Methods

BaseField adds no methods beyond the constructor guard; all serialization behavior lives in the subclasses.

See also