sqliteBasic is a lightweight SQLite wrapper for Node.js, designed to simplify database interactions while maintaining flexibility. It provides a structured approach to managing tables, schemas, and transactions.
To install sqliteBasic, use npm:
npm install @edward644/sqlitebasic
- Node.js >= 16.x
- SQLite3 >= 5.x
import { Database } from 'sqlitebasic';
const db = new Database(':memory:');
await db.open();
await db.createTable({
name: 'users',
schema: [
{ name: 'id', dataType: 'INTEGER', constraint: 'PRIMARY KEY' },
{ name: 'name', dataType: 'TEXT', constraint: 'NOT NULL' },
],
});
await db.tables['users'].insert({ id: 1, name: 'Alice' });
const users = await db.tables['users'].list();
console.log(users);
To build the project, run:
npm run build
To run the tests, use:
npm test
This project is licensed under the ISC License.