https://github.com/codewithkyle/jsql
Asynchronously access and manage your IndexedDB databases using SQL queries.
https://github.com/codewithkyle/jsql
asynchronous indexeddb offline-capable sql web-worker
Last synced: 9 months ago
JSON representation
Asynchronously access and manage your IndexedDB databases using SQL queries.
- Host: GitHub
- URL: https://github.com/codewithkyle/jsql
- Owner: codewithkyle
- License: mit
- Created: 2021-05-08T18:54:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-05T19:55:09.000Z (over 2 years ago)
- Last Synced: 2025-03-11T14:52:22.123Z (9 months ago)
- Topics: asynchronous, indexeddb, offline-capable, sql, web-worker
- Language: TypeScript
- Homepage: https://jsql.codewithkyle.com/
- Size: 6.63 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# JSQL
Access IndexedDB with SQL.
## Installation
Install via NPM
```bash
npm i -S @codewithkyle/jsql
```
Install via CDN
```javascript
import db from "https://unpkg.com/@codewithkyle/jsql@1/jsql.js";
```
## Getting Started
```javascript
import db from "https://unpkg.com/@codewithkyle/jsql@1/jsql.js";
db.start();
```
> **Hint**: read the [setup guide](https://jsql.codewithkyle.com/guides/setup) for additional details and configuration options.
## Writing Queries
Insert data into IndexedDB
```javascript
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
```javascript
const users = await db.query("SELECT * FROM users LIMIT 10")
users.map(user => console.log(user));
```