JSPM

@stash-it/sqlite-adapter

0.5.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q16345F
    • License MIT

    Package Exports

    • @stash-it/sqlite-adapter

    Readme

    @stash-it/sqlite-adapter

    logo-stash-it-color-dark 2x

    @stash-it/sqlite-adapter is a Sqlite3 adapter that can be used with @stash-it/stash-it.

    Installation

    npm

    npm install @stash-it/sqlite-adapter

    deno

    deno add @stash-it/sqlite-adapter

    yarn

    yarn dlx jsr add @stash-it/sqlite-adapter

    pnpm

    pnpm dlx jsr add @stash-it/sqlite-adapter

    bun

    bunx jsr add @stash-it/sqlite-adapter

    Usage

    // Import stash-it main class.
    import { StashIt } from "@stash-it/stash-it";
    import { SqliteAdapter, type SqliteAdapterConfiguration } from "@stash-it/sqlite-adapter";
    
    // Create an instance of the adapter.
    const adapter = new SqliteAdapter({
      connection: {
        dbPath: "path/to/your/db.sqlite",
      },
      // The whole "table" configuration is optional
      // So are the properties of this object.
      // If not provided, those values are used and expected.
      table: {
        tableName: "items",
        keyColumnName: "key",
        valueColumnName: "value",
        extraColumnName: "extra",
      },
    });
    
    // And use it with stash-it.
    const stash = new StashIt(adapter);

    Table schema

    If you don't have a table ready, you can use this query to create one. This is the expected schema.

    CREATE TABLE "items" (
      "key" TEXT PRIMARY KEY,
      "value" TEXT,
      "extra" TEXT
    )

    License

    MIT

    Contribution

    Feel free to open an issue or a pull request.