import type { RowData } from './client.ts'; import type { DuckDBDatabase } from './driver.ts'; export { splitTopLevel } from './sql/split-top-level.ts'; export interface IntrospectOptions { /** BIGINT output mode. Defaults to bigint to preserve all 64 bits. */ bigintMode?: 'bigint' | 'number'; /** * Database/catalog to introspect. If not specified, uses the current database * (via `SELECT current_database()`). This prevents returning tables from all * attached databases in MotherDuck workspaces. */ database?: string; /** * When true, introspects all attached databases instead of just the current one. * Ignored if `database` is explicitly set. * @default false */ allDatabases?: boolean; schemas?: string[]; includeViews?: boolean; useCustomTimeTypes?: boolean; mapJsonAsDuckDbJson?: boolean; importBasePath?: string; } interface DuckDbIndexRow extends RowData { database_name: string; schema_name: string; table_name: string; index_name: string; is_unique: boolean | null; expressions: string | null; sql: string | null; } export interface IntrospectedColumn { name: string; dataType: string; columnDefault: string | null; nullable: boolean; characterLength: number | null; numericPrecision: number | null; numericScale: number | null; /** * Generation expression of a generated column, or null for an ordinary * column. Undefined when the table definition could not be read. */ generatedExpression?: string | null; } export interface IntrospectedConstraint { name: string; type: string; columns: string[]; referencedTable?: { name: string; schema: string; columns: string[]; }; rawExpression?: string | null; } export interface IntrospectedTable { /** Database (catalog) that owns the table. */ database?: string; schema: string; name: string; kind: 'table' | 'view'; columns: IntrospectedColumn[]; constraints: IntrospectedConstraint[]; indexes: DuckDbIndexRow[]; } export interface IntrospectResult { files: { schemaTs: string; metaJson: IntrospectedTable[]; /** @deprecated Never populated. Will be removed in the next major version. */ relationsTs?: string; }; } export declare const DEFAULT_IMPORT_BASE = "@duckdbfan/drizzle-duckdb/helpers"; export declare function introspect(db: DuckDBDatabase, opts?: IntrospectOptions): Promise; export declare function buildDefault(defaultValue: string | null): string; export declare function normalizeTypeLiteral(raw: string): string; export declare function parseStructFields(inner: string): Array<{ name: string; type: string; }>; export declare function parseMapValue(raw: string): string; /** Returns the MAP key type, or undefined when it is a string type. */ export declare function parseMapKey(raw: string): string | undefined; export declare function toIdentifier(name: string): string;