import type { TableData, ColumnName, Value, Row } from './data'; import type { GroupChunk } from './group'; import type { Aggregation } from './aggregate'; export interface Select { columns: SelectColumn[]; distinct?: boolean; } export type SelectColumn = { column: ColumnName; alias?: ColumnName; aggregate?: Aggregation; } | { alias: ColumnName; column: ColumnEvaluate; } | { alias: ColumnName; aggregate: AggregateEvaluate; }; export type ColumnEvaluate = (params: { row: Row; source: TableData; }) => Value; export type AggregateEvaluate = (params: { group: GroupChunk; source: TableData; }) => Value; export type ColumnConfig = { column: ColumnName; aggregate?: Aggregation; } | { column: ColumnEvaluate; } | { aggregate: AggregateEvaluate; };