Block a user
@hpz937/simple-sqlite-wrapper (1.0.0)
Published 2025-05-16 21:16:56 +00:00 by hpz937
Installation
@hpz937:registry=npm install @hpz937/simple-sqlite-wrapper@1.0.0"@hpz937/simple-sqlite-wrapper": "1.0.0"About this package
simple-sqlite-wrapper
A lightweight Node.js module that provides a simple wrapper around the sqlite3 module. Easily perform common database operations like insert, update, select, and delete using a clean and consistent API.
Features
- Minimal boilerplate
- Exposes the raw
dbinstance for advanced usage - Async functions with Promises
- Auto-generates SQL for common operations
- Uses
sqlite3in verbose mode for logging
Installation
npm install simple-sqlite-wrapper
Usage
import createDatabase from 'simple-sqlite-wrapper';
const { db, insert, update, select, delete: remove } = createDatabase('./data/my-database.sqlite');
(async () => {
await insert('users', { name: 'Alice', email: 'alice@example.com' });
await update('users', { email: 'alice@newmail.com' }, { name: 'Alice' });
const results = await select('users', { name: 'Alice' });
console.log(results);
await remove('users', { name: 'Alice' });
db.close(); // optional
})();
API
createDatabase(dbFilePath)
Returns an object with:
db: the rawsqlite3.Databaseinstanceinsert(table, data)update(table, data, where)select(table, where?)delete(table, where)
Example
Insert
await insert('users', { name: 'John', email: 'john@example.com' });
Update
await update('users', { email: 'new@example.com' }, { id: 1 });
Select
const rows = await select('users', { id: 1 });
Delete
await remove('users', { id: 1 });
License
MIT
Dependencies
Dependencies
| ID | Version |
|---|---|
| sqlite3 | ^5.1.7 |
Keywords
sqlite
sqlite3
database
wrapper
nodejs
crud
sqlite-helper
Details
2025-05-16 21:16:56 +00:00
Assets (1)
Versions (1)
View all
npm
1
Your Name
MIT
latest
1.7 KiB
simple-sqlite-wrapper-1.0.0.tgz
1.7 KiB
1.0.0
2025-05-16