@photostructure/sqlite-diskann
    Preparing search index...

    Interface DatabaseLike

    Minimal database interface compatible with multiple SQLite implementations.

    Compatible libraries:

    • node:sqlite DatabaseSync (Node 22+)
    • better-sqlite3 Database
    • @photostructure/sqlite DatabaseSync

    This interface defines only the methods actually used by sqlite-diskann. Any SQLite library providing these methods can be used.

    // Node 22+ built-in
    import { DatabaseSync } from 'node:sqlite';
    const db = new DatabaseSync(':memory:');

    // better-sqlite3
    import Database from 'better-sqlite3';
    const db = new Database(':memory:');

    // @photostructure/sqlite
    import { DatabaseSync } from '@photostructure/sqlite';
    const db = new DatabaseSync(':memory:');

    // All work with sqlite-diskann
    loadDiskAnnExtension(db);
    interface DatabaseLike {
        exec(sql: string): void;
        loadExtension(path: string, entryPoint?: string): void;
        prepare(sql: string): StatementLike;
    }
    Index

    Methods

    • Execute one or more SQL statements without returning results Used for DDL (CREATE TABLE, etc.) and DML without result rows

      Parameters

      • sql: string

        SQL statement(s) to execute

      Returns void

    • Load a SQLite extension from a file path

      Parameters

      • path: string

        Absolute path to the extension file (.so, .dylib, .dll)

      • OptionalentryPoint: string

        Optional entry point function name (default: sqlite3_extension_init)

      Returns void

    • Compile a SQL statement into a prepared statement

      Parameters

      • sql: string

        SQL statement with optional placeholders (?)

      Returns StatementLike

      Prepared statement object