lightql
v0.3.4
Published
Simple yet powerful SQLite3 wrapper for NodeJS
Downloads
6
Maintainers
Readme
LightQL
Simple yet powerful SQLite3 wrapper for NodeJS
Install
npm install lightql
Usage
const lightql = require("lightql"); // initialize the module
const database = new lightql("testing"); // create a new database
// create a new table called users
database.addTable("users", { id: "INTEGER", name: "TEXT" });
// insert a new row into the users table
database.insert([0, "pyxel"], "users");
// fetch all rows with an id of 0 and log them
database.fetch("id", 0, "users").then(rows => console.log(rows));
// update rows with a specific query
database.update("id", 0, { name: "new_name" }, "users");
// delete rows with a specific query
database.delete("id", 0, "users");
// delete a existing table in the database
database.dropTable("users");
// finally, close the database connection
database.close();
Notice: All functions except for close and fetch are serialized, they do not run in parallel
This module uses JSDoc allowing devs to easier use the lib