sedk-postgres
Version:
Simple SQL builder and validator
36 lines (35 loc) • 1.74 kB
TypeScript
import { IntoColumnsStep, IntoTableStep } from './steps/insert-path/IntoStep';
import { FromItem } from './steps/select-path/SelectFromStep';
import { Column, Database, Table } from './database';
import { PrimitiveType } from './models';
import { All, Distinct } from './singletoneConstants';
import { DeleteFromStep, DeleteStep, FromItems, InsertStep, RootStep, SelectFromStep, SelectItem, SelectStep, UpdateStep } from './steps';
import { SelectItemInfo } from './SelectItemInfo';
import { BuilderOption, BuilderOptionRequired } from './option';
export type BuilderData = {
database: Database;
option: BuilderOptionRequired;
};
/**
* @deprecated - use builder() function instead
*/
export declare class Builder {
private readonly data;
private rootStep;
constructor(database: Database, option?: BuilderOption);
select(distinct: Distinct | All, ...items: (SelectItemInfo | SelectItem | PrimitiveType)[]): SelectStep;
select(...items: (SelectItemInfo | SelectItem | PrimitiveType)[]): SelectStep;
selectDistinct(...items: (SelectItemInfo | SelectItem | PrimitiveType)[]): SelectStep;
selectAll(...items: (SelectItemInfo | SelectItem | PrimitiveType)[]): SelectStep;
selectAsteriskFrom(...tables: FromItems): SelectFromStep;
delete(): DeleteStep;
deleteFrom(fromItem: FromItem): DeleteFromStep;
insert(): InsertStep;
insertInto(table: Table): IntoTableStep;
insertInto(table: Table, ...columns: Column[]): IntoColumnsStep;
update(table: Table): UpdateStep;
/** @deprecated - Not needed since version 0.15.0 */
cleanUp(): Builder;
private static throwIfMoreThanOneDistinctOrAll;
}
export declare function builder(database: Database, option?: BuilderOption): RootStep;