lets-sqlite
v1.2.10
Published
A wrapper of SQLite3, which implemented async/await ES6 style, makes using SQLite more user-friendly.
Maintainers
Readme
Install
npm install lets-sqliteQuick Showcase
Create, Update, Query and Transaction:
import { SQLite } from "lets-sqlite" // import module
import path from 'path'
const databaseFileAddress = path.join(path.dirname(__filename), 'my-lets-sqlite.db');
/** Construct a new database connection class **/
const database = new SQLite(databaseFileAddress)
/** Create a new `Demo` table in my-lets-sqlite.db **/
await database.create(`CREATE TABLE IF NOT EXISTS "Demo" (
"id" INTEGER NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"password" TEXT NOT NULL,
"createdAt" INTEGER NOT NULL,
"updatedAt" INTEGER NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
)`);
//================
let updateString = `Insert into Demo (name, password, createdAt, updatedAt) Values (?, ?, ?, ?)`
let parameterUpdate = ['x', 'ABC', Date.now(), Date.now()]
/** Update record in SQLite **/
let resultUpdate = await database.update(updateString, parameterUpdate)
//================
let queryString = `Select * From Demo Where id = ?`
let parameterQuery = [1]
/** Query records in SQLite **/
let resultQuery = await database.query(queryString, parameterQuery)
//================
let tableName = `Demo`
let s1 = database.prepare(`Delete from ${tableName}`)
let s2 = database.prepare(`Update sqlite_sequence SET seq = ? Where name = ?`, [0, tableName])
/** Making a transaction in SQLite **/
let resultTransaction = await database.transaction([s1, s2])
await database.close()Unit Test Outcome

Advantages of ES6 async/await Style
- Improved Readability and Maintainability
- Better Error Handling
- Composition and Chaining
- Simplicity and Consistency
- Parallel Execution
- Debugging and Tooling
...etc.
More development on the way
SQLCipher
SQLCipher is an extension of the SQLite database engine that provides transparent, on-the-fly encryption for the database files. With encrypted SQLite databases, it is particularly useful for applications that need to store sensitive data securely.
😁😁😁 Happy Development ~~~
License
=======
The MIT License (MIT)
Copyright (c) 2025 Ivan LEE [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
