A Kysely dialect for Tauri apps using the official @tauri-apps/plugin-sql to connect to databases. Current stable version is 1.2.1. It is developed as part of the kysely-sqlite-tools monorepo. Currently only supports SQLite. The dialect leverages Tauri's SQL plugin to load databases asynchronously, using a callback pattern that provides the SQLite prefix. It is primarily used with Kysely (>=0.26) and requires @tauri-apps/plugin-sql ^2.0.0. Differentiating from other Kysely dialects, it is specifically designed for Tauri environments with proper async loading and connection lifecycle management.
npm install kysely-dialect-tauriNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Kysely instance configured with the Tauri SQLite dialect, using @tauri-apps/plugin-sql to load a database file from the app data directory.
Use for SQLite only. Do not attempt to connect to PostgreSQL or MySQL databases with this dialect.
When using the function form, remember that the prefix is 'sqlite:' (string). Example: async (prefix) => Database.load(`${prefix}${await appDataDir()}test.db`)If you don't need custom connection initialization, omit the option.
Only use this dialect inside a Tauri application. For testing, consider mocking the plugin.
Ensure your project has @tauri-apps/plugin-sql@^2.0.0 and kysely@>=0.26 installed.
Run `npm install kysely-dialect-tauri` and ensure import is `import { TauriSqliteDialect } from 'kysely-dialect-tauri'`Use `import { TauriSqliteDialect } from 'kysely-dialect-tauri'` instead of `import TauriSqliteDialect from 'kysely-dialect-tauri'`Provide either a Database instance from @tauri-apps/plugin-sql or a function that returns one. Example: `database: async (prefix) => Database.load(...)`