@devbro/sql-generator
Version:
generic sql generator
40 lines (37 loc) • 1.31 kB
text/typescript
import { P as Parameter } from './types-C_aDrXJN.mjs';
type ColumnPropertiesType = {
type: 'string' | 'integer' | 'float' | 'double' | 'boolean' | 'char' | 'text' | 'date' | 'timestamp' | 'serial';
length: number;
nullable: boolean;
unique: boolean;
default: Parameter;
};
declare class Column {
columnName: string;
properties: ColumnPropertiesType;
constructor(columnName: string, type: ColumnPropertiesType['type']);
length(length: number): this;
nullable(nullable?: boolean): this;
unique(unique?: boolean): this;
default(value: ColumnPropertiesType['default']): this;
}
declare class Blueprint {
tableName: string;
columns: Column[];
existingTable: boolean;
primaryKeys: string[];
constructor();
setTableName(tableName: string, existingTable?: boolean): void;
Boolean(columnName: string): Column;
char(columnName: string): Column;
string(columnName: string, length?: number): Column;
text(columnName: string): Column;
integer(columnName: string): Column;
float(columnName: string): Column;
double(columnName: string): Column;
id(): Column;
timestamps(): void;
date(columnName: string): Column;
primary(keys: string[]): void;
}
export { Blueprint, Column, type ColumnPropertiesType };