// TypeScript bindings for emscripten-generated code.  Automatically generated at compile time.
declare namespace RuntimeExports {
    /**
     * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
     * emscripten HEAP, returns a copy of that string as a Javascript String object.
     *
     * @param {number} ptr
     * @param {number=} maxBytesToRead - An optional length that specifies the
     *   maximum number of bytes to read. You can omit this parameter to scan the
     *   string until the first 0 byte. If maxBytesToRead is passed, and the string
     *   at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
     *   string will cut short at that byte index.
     * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
     * @return {string}
     */
    function UTF8ToString(ptr: number, maxBytesToRead?: number | undefined, ignoreNul?: boolean | undefined): string;
    function lengthBytesUTF8(str: any): number;
    function stringToUTF8(str: any, outPtr: any, maxBytesToWrite: any): any;
    let HEAPU8: Uint8Array;
    let FS_createPath: any;
    function FS_createDataFile(parent: any, name: any, fileData: any, canRead: any, canWrite: any, canOwn: any): void;
    function FS_preloadFile(parent: any, name: any, url: any, canRead: any, canWrite: any, dontCreateFile: any, canOwn: any, preFinish: any): Promise<void>;
    function FS_unlink(path: any): any;
    function addRunDependency(id: any): void;
    function removeRunDependency(id: any): void;
}
interface WasmModule {
  _malloc(_0: number): number;
  _free(_0: number): void;
}

type EmbindString = ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
export interface ClassHandle {
  isAliasOf(other: ClassHandle): boolean;
  delete(): void;
  deleteLater(): this;
  isDeleted(): boolean;
  // @ts-ignore - If targeting lower than ESNext, this symbol might not exist.
  [Symbol.dispose](): void;
  clone(): this;
}
export interface LogicalType extends ClassHandle {
  isIntegral(): boolean;
  isFloating(): boolean;
  isNumeric(): boolean;
  isTemporal(): boolean;
  isValid(): boolean;
  isComplete(): boolean;
  isSigned(): boolean;
  isUnsigned(): boolean;
  hasAlias(): boolean;
  id(): number;
  physicalType(): number;
  stringify(): string;
  setAlias(_0: EmbindString): void;
  getAlias(): string;
}

export interface Value extends ClassHandle {
  type(): LogicalType;
  copy(): Value;
  isNull(): boolean;
  getBoolean(): boolean;
  getInt32(): number;
  getFloat(): number;
  getDouble(): number;
  stringify(): string;
  toSQLString(): string;
  getString(): string;
}

export interface ErrorData extends ClassHandle {
  hasError(): boolean;
  message(): string;
  rawMessage(): string;
}

export interface BaseQueryResult extends ClassHandle {
  setError(_0: ErrorData): void;
  hasError(): boolean;
  resultType(): number;
  statementType(): number;
  columnCount(): bigint;
  columnCount(): bigint;
  throwError(_0: EmbindString): void;
  getError(): string;
  columnNames(): any;
  columnTypes(): any;
}

export interface QueryResult extends BaseQueryResult {
  print(): void;
  stringify(): string;
  columnName(_0: bigint): string;
}

export interface ColumnDataCollection extends ClassHandle {
  count(): bigint;
  columnCount(): bigint;
}

export interface MaterializedQueryResult extends QueryResult {
  collection(): ColumnDataCollection;
  rowCount(): bigint;
  toJSON(): string;
  getValue(_0: number, _1: number): any;
}

export interface PreparedStatement extends ClassHandle {
  hasError(): boolean;
  statementType(): number;
  columnCount(): bigint;
  getError(): string;
  execute(_0: any): QueryResult | null;
  names(): any;
  types(): any;
}

export interface Connection extends ClassHandle {
  interrupt(): void;
  beginTransaction(): void;
  commit(): void;
  rollback(): void;
  setAutoCommit(_0: boolean): void;
  isAutoCommit(): boolean;
  hasActiveTransaction(): boolean;
  getQueryProgress(): number;
  prepare(_0: EmbindString): PreparedStatement | null;
  query(_0: EmbindString): MaterializedQueryResult | null;
  queryToJSON(_0: EmbindString): string;
}

export interface DuckDB extends ClassHandle {
  connect(): Connection | null;
  terminate(): void;
  numberOfThreads(): bigint;
}

interface EmbindModule {
  LogicalType: {
    new(): LogicalType;
  };
  Value: {
    new(): Value;
  };
  ErrorData: {
    new(): ErrorData;
  };
  BaseQueryResult: {};
  QueryResult: {};
  ColumnDataCollection: {};
  MaterializedQueryResult: {};
  PreparedStatement: {};
  Connection: {};
  DuckDB: {
    standardVectorSize(): number;
    sourceID(): string;
    libraryVersion(): string;
    releaseCodename(): string;
    platform(): string;
  };
  create(): DuckDB | null;
  standardVectorSize(): number;
  libraryVersion(): string;
  sourceID(): string;
  releaseCodename(): string;
  platform(): string;
}

export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule;
export default function MainModuleFactory (options?: unknown): Promise<MainModule>;
