import { Client as PGClient } from "pg"; import { Dialect } from "../../core/db"; import { Database as SqliteDatabase } from "better-sqlite3"; import { BuilderSchema } from "../builder"; import { Ent } from "../../core/base"; interface SchemaItem { name: string; } interface Column extends SchemaItem { datatype(): string; nullable?: boolean; primaryKey?: boolean; default?: string; foreignKey?: { table: string; col: string; }; } interface Constraint extends SchemaItem { generate(): string; } export interface Table { name: string; columns: Column[]; constraints?: Constraint[]; create(): string; drop(): string; } declare type options = Pick; export declare function primaryKey(name: string, cols: string[]): Constraint; export declare function foreignKey(name: string, cols: string[], fkey: { table: string; cols: string[]; }): Constraint; export declare function uuid(name: string, opts?: options): Column; export declare function text(name: string, opts?: options): Column; export declare function timestamp(name: string, opts?: options): Column; export declare function timestamptz(name: string, opts?: options): Column; export declare function time(name: string, opts?: options): Column; export declare function timetz(name: string, opts?: options): Column; export declare function date(name: string, opts?: options): Column; export declare function bool(name: string, opts?: options): Column; export declare function integer(name: string, opts?: options): Column; export declare function float(name: string, opts?: options): Column; export declare function textList(name: string, opts?: options): Column; export declare function integerList(name: string, opts?: options): Column; export declare function uuidList(name: string, opts?: options): Column; export declare function timestampList(name: string, opts?: options): Column; export declare function timestamptzList(name: string, opts?: options): Column; export declare function timeList(name: string, opts?: options): Column; export declare function timetzList(name: string, opts?: options): Column; export declare function dateList(name: string, opts?: options): Column; export declare function boolList(name: string, opts?: options): Column; export declare function table(name: string, ...items: SchemaItem[]): Table; export declare class TempDB { private db; private client; private dbClient; private tables; private dialect; private sqlite; constructor(dialect: Dialect, tables?: Table[]); constructor(tables: Table[]); getDialect(): Dialect; getTables(): Map; beforeAll(): Promise; getSqliteClient(): SqliteDatabase; getPostgresClient(): PGClient; afterAll(): Promise; dropAll(): Promise; drop(...tables: string[]): Promise; create(...tables: Table[]): Promise; } export declare function assoc_edge_config_table(): Table; export declare function assoc_edge_table(name: string): Table; interface sqliteSetupOptions { disableDeleteAfterEachTest?: boolean; } export declare function setupSqlite(connString: string, tables: () => Table[], opts?: sqliteSetupOptions): void; export declare function getSchemaTable(schema: BuilderSchema, dialect: Dialect): Table; export {};