import QueryTable from "../query-table";
import NumberColumn from "./number-column";
import GenericsHelper from "../helpers/generics-helper";
import QueryColumnCondition from "../condition/query-column-condition";
import {ColumnModifier, ColumnName} from "../helpers/internal-types";
abstract class QueryColumn
, T> {
protected _$type: GenericsHelper;
protected _type: string;
constructor(
protected _table: Table,
protected _name: ColumnName,
protected _modifiers: ColumnModifier[] = []
) {}
abstract count(): NumberColumn; // TODO I had to copy-paste the implementation to every child class to avoid a circular dependency
as(alias: string): this {
return new (this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'as', params: alias }));
}
isNull() {
return new QueryColumnCondition(this, 'is-null');
}
isNotNull() {
return new QueryColumnCondition(this, 'is-not-null');
}
}
export default QueryColumn;