JSQL
Access IndexedDB with SQL.
Installation
Install via NPM
npm i -S @codewithkyle/jsql
Install via CDN
import db from "https://unpkg.com/@codewithkyle/jsql@1/jsql.js";
Getting Started
import db from "https://unpkg.com/@codewithkyle/jsql@1/jsql.js";
db.start();
Hint: read the setup guide for additional details and configuration options.
Writing Queries
Insert data into IndexedDB
db.query("INSERT INTO users VALUES ($user1, $user2)", {
user1: {
name: "Frank",
email: "franky123@example.com",
},
user2: {
name: "April Summers",
email: "popartfan18@example.com",
}
});
Query data from IndexedDB
const users = await db.query("SELECT * FROM users LIMIT 10")
users.map(user => console.log(user));