lightql

0.3.4 • Public • Published

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

Package Sidebar

Install

npm i lightql

Weekly Downloads

14

Version

0.3.4

License

Apache-2.0

Unpacked Size

19.5 kB

Total Files

6

Last publish

Collaborators

  • pyxelx