import { Any, KeyOf, List, ValueOrGetter } from "@mantlebee/ts-core"; import { IColumn, IDatabase, ITable, IColumnRelation } from "./interfaces"; import { Dataset, ColumnOptions, RowsCountsMap, TableKey } from "./types"; /** * Abstract implementation of {@link IColumn}. */ export declare abstract class ColumnAbstract implements IColumn { readonly options: ValueOrGetter; readonly name: KeyOf; constructor(name: KeyOf, options?: ValueOrGetter); abstract getValue(row: TRow): TValue; } /** * Abstract implementation of {@link IColumnRelation} */ export declare abstract class ColumnRelationAbstract extends ColumnAbstract implements IColumnRelation { protected defaultValue: TValue; targetTableKey: TableKey; constructor(name: KeyOf, defaultValue: TValue, targetTableKey: TableKey, options?: ValueOrGetter); getValue(): TValue; abstract setValues(sourceRows: List, targetRows: List, dataset: Dataset): void; } /** * Implementation of {@link IDatabase}. * It uses the delegate {@link getDatabaseDataset} to generate the dataset. * The resulting {@link Dataset} can be accessed both through the table's name and key. */ export declare class Database implements IDatabase { readonly tables: List>; private _dataset; constructor(tables: List>); getDataset(): Dataset; getTable(tableKey: TableKey): ITable; /** * Generates the database dataset, it is a dictionary, where the keys are the tables' keys, and the values are the generated rows. * @param rowsCountsMap Dictionary with the tables counts, used to generate a specific amount of rows for each table. It is a dictionary where the keys are the tables' keys, and the values the row counts to generate. * @returns the database instance. Useful to concatenate operations. */ seed(rowsCountsMap: RowsCountsMap): IDatabase; } /** * Implementation of {@link ITable}. * It uses the delegate {@link getTableRows} to generate the rows. */ export declare class Table implements ITable { readonly key: TableKey; readonly columns: List>; private _rows; /** * * @param key {@link TableKey}, created with {@link createTableKey}. Description must be exists. * @param columns List of table columns. */ constructor(key: TableKey, columns: List>); getRows(): List; seed(rowsCount: number): ITable; }