Registry / database / tauri-plugin-sqlite-api

tauri-plugin-sqlite-api

JSON →
library0.1.2jsnpmunverified

A Tauri plugin for SQLite databases based on Sqlx, currently at version 0.1.2. It provides a consistent API with the official Tauri SQL plugin but exclusively supports SQLite, with additional support for SQLite extensions. The package is actively maintained with regular updates. It is designed for Tauri v2 and offers both Rust and frontend APIs for database operations like load, execute, select, and close, with automatic resource cleanup.

npm install tauri-plugin-sqlite-api
INSTALL
IMPORT
SIG · TAURI-PLUGIN-SQLIT
T
tauri-plugin-sqlite-api
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

load
import { load } from 'tauri-plugin-sqlite-api'
const load = require('tauri-plugin-sqlite-api').load
Package uses ESM; CommonJS require may cause issues in module-based projects
execute
import { execute } from 'tauri-plugin-sqlite-api'
import { execute } from '@tauri-apps/plugin-sql'
Commonly confused with the official Tauri SQL plugin; ensure correct package name
select
import { select } from 'tauri-plugin-sqlite-api'
close
import { close } from 'tauri-plugin-sqlite-api'
load, execute, select, close
import { load, execute, select, close } from 'tauri-plugin-sqlite-api'
import Database from 'tauri-plugin-sqlite-api'
No default export; all functions are named exports. Using default import will result in undefined

Demonstrates loading a SQLite database, executing an insert, selecting rows with placeholders, and closing the connection.

import { load, execute, select, close } from 'tauri-plugin-sqlite-api'; // Load the database const db = await load({ db_url: 'sqlite:test.db' }); // Execute an INSERT const result = await execute(db, 'INSERT INTO users (name) VALUES (?)', ['John']); console.log(result); // { rowsAffected: 1, lastInsertId: 1 } // Query data const rows = await select(db, 'SELECT * FROM users WHERE name = ?', ['John']); console.log(rows); // [{ id: 1, name: 'John' }] // Close the connection await close(db);
Debug
Known issues
gotchaThe `load` function expects an object with `db_url` property, not a plain string.
fix
Use `load({ db_url: 'sqlite:test.db' })` instead of `load('sqlite:test.db')`.
affects: >=0.1.0
breakingPackage version 0.x may have breaking changes in minor releases as it is pre-1.0.
fix
Pin exact version in package.json or use lockfile. Check changelog before upgrading.
affects: >=0.0.0
gotchaThe plugin requires Tauri v2; it is not compatible with Tauri v1.
fix
Ensure your Tauri app is using v2 (tauri 2.x).
affects: >=0.1.0
gotchaResource lifecycle: the `db` object returned by `load` must be closed manually with `close(db)` to avoid memory leaks.
fix
Always call `await close(db)` when done, or use the automatic resource cleanup provided by Tauri if configured.
affects: >=0.1.0
deprecatedUsing `require` syntax with this package may trigger warnings or errors in newer Node/Tauri versions.
fix
Use ES module imports (import { ... } from 'tauri-plugin-sqlite-api').
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: load is not a function
Importing the package incorrectly, e.g., using default import or CommonJS require that doesn't match exported members.
fix
Use named import: `import { load } from 'tauri-plugin-sqlite-api'`.
Error: Cannot find module 'tauri-plugin-sqlite-api' or its corresponding type declarations.
Package not installed or TypeScript configuration missing module resolution for node_modules.
fix
Run `npm install tauri-plugin-sqlite-api` and ensure tsconfig.json has `"moduleResolution": "node"` or `"nodenext"`.
Uncaught (in promise) TauriError: Plugin not found: sqlite
The Rust plugin `tauri-plugin-sqlite` is not registered in the Tauri builder.
fix
Add `.plugin(tauri_plugin_sqlite::Builder::default().build())` in your Rust main function.
Error: db_url must be a string starting with 'sqlite:'
Passing an invalid or malformed `db_url` to the `load` function.
fix
Ensure `db_url` is a string like `'sqlite:test.db'`.
Error: SQLite error: no such table: users
The table has not been created before running the select or execute query.
fix
Run a migration in Rust to create the necessary tables, or execute a CREATE TABLE statement first.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
tauri-plugin-sqliteoptionalRust crate that provides the core plugin implementation; the frontend API package depends on it for functionality
Agent activity
20 hits · last 30 days
node
16
Meta
2
OpenAI (training)
1
Resources
tauri-plugin-sqlite-api — npm install tauri-plugin-sqlite-api · libregistry