Skip to content

Releases: CesiumLabs/json-sql-query

v2.0.0

06 May 16:09
Compare
Choose a tag to compare
  • Package got renamed, yay

v1.0.5

06 May 13:42
Compare
Choose a tag to compare
  • Partially supports WHERE with SELECT
  • Result from SELECT now has parse method to parse the data properly

v1.0.4

06 May 12:26
Compare
Choose a tag to compare
  • fix module name

v1.0.3

06 May 12:22
Compare
Choose a tag to compare
  • fix typings

v1.0.2

06 May 12:17
Compare
Choose a tag to compare
  • support for UPDATE
  • support for DELETE

v1.0.1

06 May 03:27
Compare
Choose a tag to compare
  • supports memory db

v1.0.0

06 May 03:10
Compare
Choose a tag to compare

JSQL

Use JSON as SQL.

Installing

$ npm i --save @devsnowflake/jsql

Note: This library is very new and does not support most of the statements

Example

const { Database } = require("@devsnowflake/jsql");
const db = new Database("./database.json");

// creating a table
db.prepare(`CREATE TABLE IF NOT EXISTS "DEMO" ("key" TEXT, "value" TEXT)`).run();

// inserting data
db.prepare(`INSERT INTO "DEMO" ("key","value") VALUES ("test_key", "test_value")`).run();

// fetching data
db.prepare(`SELECT * FROM "DEMO"`).run();

// fetching data in limit
db.prepare(`SELECT * FROM "DEMO" LIMIT 3`).run(); // returns 3 items if available

// drop a table
db.prepare(`DROP TABLE "DEMO"`).run();