Registry / database / doric-sqlite

doric-sqlite

JSON →
library0.2.6jsnpmunverified

DoricSQLite is an extension library for the Doric framework (>=0.8.26) that provides SQLite storage support for Doric applications. Current version is 0.2.6, with moderate release cadence. It integrates seamlessly with Doric's reactive system, allowing persistent data operations similar to other Doric data sources. Key differentiators: enables native SQLite capabilities within Doric apps without external dependencies. As a Doric extension, it follows the same data-binding and lifecycle patterns as other Doric modules.

npm install doric-sqlite
INSTALL
IMPORT
SIG · DORIC-SQLITE
D
doric-sqlite
databasejavascriptv0.2.6
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.

default
import DoricSQLite from 'doric-sqlite'
const DoricSQLite = require('doric-sqlite')
The package is ESM-only, so require() will fail. Default import provides the main class.
DoricSQLite
import { DoricSQLite } from 'doric-sqlite'
import DoricSQLite from 'doric-sqlite'
Named export available for explicit imports; both default and named are equivalent.
type
import type { DoricSQLite } from 'doric-sqlite'
TypeScript users can import the type directly for type annotations.

Shows basic SQLite database creation, table creation, insert, and query using DoricSQLite.

import DoricSQLite from 'doric-sqlite'; // Instantiate with a database path (or default ':memory:') const db = new DoricSQLite({ path: 'mydb.sqlite' }); // Create a table and insert data using Doric's reactive syntax await db.run(`CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)`); await db.run(`INSERT INTO users (name, age) VALUES (?, ?)`, ['Alice', 30]); // Query data const users = await db.all(`SELECT * FROM users`); console.log(users); // [{ id: 1, name: 'Alice', age: 30 }] // Use with Doric reactive components (if applicable, adjust per Doric version) // Note: The library follows Doric's async/await pattern.
Debug
Known issues
breakingAPI may change significantly between minor versions before 1.0.0.
fix
Pin exact version and test upgrades thoroughly.
affects: <1.0.0
gotchaDoricSQLite is a Doric extension; must be used inside a Doric application context.
fix
Ensure Doric is initialized before using DoricSQLite.
affects: *
gotchaDatabase file path is relative to the app's data directory, not the current working directory.
fix
Use absolute paths or rely on Doric's default storage location.
affects: *
deprecatedThe synchronous API (e.g., `db.exec()`) is deprecated in favor of async methods (`run`, `all`).
fix
Replace synchronous calls with async/await.
affects: >=0.2.0
Errors
Common errors & fixes
Error: Cannot find module 'doric'
Missing peer dependency 'doric'.
fix
npm install doric@>=0.8.26
TypeError: Cannot read properties of undefined (reading 'run')
DoricSQLite instance created outside Doric context.
fix
Ensure Doric is initialized before instantiating DoricSQLite.
Error: SQLITE_ERROR: no such table: users
Table not created before querying.
fix
Use CREATE TABLE IF NOT EXISTS before inserting/selecting.
Upgrade
Version history
0.2.6latest on npm
Audit
Dependencies
doricrequiredPeer dependency; DoricSQLite requires Doric framework >=0.8.26 to function.
Agent activity
4 hits · last 30 days
node
4
Resources