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