TableColumn<T, Tbl> class sealed Schema & Columns

A typed column belonging to table Tbl.

Sealed: every column is exactly one of ValueColumn, PrimaryKey or Ref (a foreign key). This lets the join API and codegen pattern-match on the column kind and gives FK-aware joins.

Columns are declared static const on a table marker class so the same object serves the query builder (Users.age.gt(18)) and derive annotations (@Column(Users.name)) — annotation arguments must be constants. A column is also a Selection, so it can be read straight out of a row.

A column holds a typed reference to its owner source (the marker's static const table singleton, or a TableAlias for rebound columns); the shared Tbl makes handing a column to the wrong table a compile error.

Implemented types
Implementers
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
no setter
node → ColumnNode
no setter
owner QuerySource<Tbl>
The typed source this column is bound to: its table marker, or the TableAlias it was rebound to.
no setter
readKey String
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectAlias String?
no setteroverride
selectExpression → SqlNode
no setteroverride
table String
The effective SQL qualifier — the owner's alias if it has one, otherwise its table name.
no setter
type SqlType<T>
no setteroverride

Methods

asc() Ordering
avg() Aggregate<double?>

Available on TableColumn<double, Tbl>, provided by the DoubleColumnAggregates extension

avg() Aggregate<double?>

Available on TableColumn<int, Tbl>, provided by the IntColumnAggregates extension

between(T low, T high) Expression<bool, Tbl>
count() Aggregate<int>
COUNT(this_column) — a non-null count, selectable and readable.
desc() Ordering
eq(T value) Expression<bool, Tbl>
eqAny(List<T> values) Expression<bool, Tbl>
basalt-style alias for isIn (eq_any).
eqColumn<Other>(TableColumn<T, Other> other) Expression<bool, Tbl>
Compares this column to another column — for JOIN ON clauses and cross-table predicates. The shared T enforces matching key types (Users.id.eqColumn(Posts.title) is a compile error).
ge(T value) Expression<bool, Tbl>
gt(T value) Expression<bool, Tbl>
isIn(List<T> values) Expression<bool, Tbl>
isNotNull() Expression<bool, Tbl>
isNull() Expression<bool, Tbl>
le(T value) Expression<bool, Tbl>
like(String pattern) Expression<bool, Tbl>

Available on TableColumn<String, Tbl>, provided by the TextColumn extension

lt(T value) Expression<bool, Tbl>
max() Aggregate<double?>

Available on TableColumn<double, Tbl>, provided by the DoubleColumnAggregates extension

max() Aggregate<int?>

Available on TableColumn<int, Tbl>, provided by the IntColumnAggregates extension

min() Aggregate<double?>

Available on TableColumn<double, Tbl>, provided by the DoubleColumnAggregates extension

min() Aggregate<int?>

Available on TableColumn<int, Tbl>, provided by the IntColumnAggregates extension

ne(T value) Expression<bool, Tbl>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(T value) ColumnValue<Tbl>
Produces a typed assignment for INSERT/UPDATE, e.g. Users.age.set(31). The value type is pinned by this column's static type (no inference), so TableColumn<int>.set('x') is a compile error.
setExpr(Expression<Object?, Tbl> value) ColumnValue<Tbl>
RHS expression for UPDATE, e.g. stock = stock - ?.
setToExcluded() ColumnValue<Tbl>
For upserts: col = excluded."col" inside ON CONFLICT ... DO UPDATE, i.e. take the value from the row that failed to insert.
sum() Aggregate<double?>

Available on TableColumn<double, Tbl>, provided by the DoubleColumnAggregates extension

sum() Aggregate<int?>

Available on TableColumn<int, Tbl>, provided by the IntColumnAggregates extension

toString() String
A string representation of this object.
inherited

Operators

operator *(Object other) Expression<num, Tbl>

Available on TableColumn<num, Tbl>, provided by the NumColumnArithmetic extension

operator +(Object other) Expression<num, Tbl>

Available on TableColumn<num, Tbl>, provided by the NumColumnArithmetic extension

operator -(Object other) Expression<num, Tbl>

Available on TableColumn<num, Tbl>, provided by the NumColumnArithmetic extension

operator /(Object other) Expression<num, Tbl>

Available on TableColumn<num, Tbl>, provided by the NumColumnArithmetic extension

operator <(T value) Expression<bool, Tbl>
operator <=(T value) Expression<bool, Tbl>
operator ==(Object other) bool
The equality operator.
inherited
operator >(T value) Expression<bool, Tbl>
operator >=(T value) Expression<bool, Tbl>