gluesql 0.3.2 → 0.10.2-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,118 +1,55 @@
1
- # GlueSQL-js
2
- [![npm version](https://badge.fury.io/js/gluesql.svg)](https://badge.fury.io/js/gluesql)
3
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
1
+ # GlueSQL.js
4
2
 
5
- > Use SQL in web browsers!
6
- * [Demo - https://gluesql.org/playground](https://gluesql.org/playground/)
3
+ [![npm](https://img.shields.io/npm/v/gluesql)](https://www.npmjs.com/package/gluesql)
4
+ [![GitHub](https://img.shields.io/github/stars/gluesql/gluesql)](https://github.com/gluesql/gluesql)
5
+ [![LICENSE](https://img.shields.io/crates/l/gluesql.svg)](https://github.com/gluesql/gluesql/blob/main/LICENSE)
6
+ [![Chat](https://img.shields.io/discord/780298017940176946)](https://discord.gg/C6TDEgzDzY)
7
+ [![codecov.io](https://codecov.io/github/gluesql/gluesql/coverage.svg?branch=main)](https://codecov.io/github/gluesql/gluesql?branch=main)
7
8
 
8
- GlueSQL-js provides 3 storage options
9
- * In-memory
10
- * LocalStorage
11
- * SessionStorage
9
+ GlueSQL.js is a SQL database for web browsers and Node.js. It works as an embedded database and entirely runs in the browser.
10
+ GlueSQL.js supports in-memory storage backend, but it will soon to have localStorage, sessionStorage and indexedDB backend supports.
12
11
 
13
- ## :package: Installation
12
+ ## Installation
13
+
14
+ #### Yarn
15
+ ```
16
+ yarn add gluesql
17
+ ```
18
+
19
+ #### npm
14
20
  ```
15
21
  npm install gluesql
16
22
  ```
17
23
 
18
- ## :cloud: Usage
24
+ #### JavaScript modules
19
25
  ```javascript
20
- const gluesql = import('gluesql');
21
-
22
- async function main() {
23
- const { Glue } = await gluesql;
24
- const db = new Glue("memory");
25
- /* other options:
26
- const db = new Glue("localstorage", "{db-name}");
27
- const db = new Glue("sessionstorage", "{db-name}");
28
- */
29
-
30
- const sql = `
31
- CREATE TABLE Test (id INTEGER, name TEXT);
32
- INSERT INTO Test VALUES (101, "Glue");
33
- INSERT INTO Test VALUES (102, "Rust");
34
- INSERT INTO Test VALUES (103, "Yeah");
35
- `;
36
-
37
- await db.execute(sql);
38
-
39
- const items = (await db.execute("SELECT * FROM Test WHERE id < 103;"))[0];
40
- /* items:
41
- [
42
- [101, "Glue"],
43
- [102, "Rust"],
44
- ]
45
- */
46
- }
26
+ import { gluesql } from 'https://cdn.jsdelivr.net/npm/gluesql@0.10.2-rc.2/gluesql.js';
47
27
  ```
48
28
 
49
- ## :sparkles: Examples
50
- * [GlueSQL JavaScript Seed](https://github.com/gluesql/gluesql-js-seed)
51
- * [GlueSQL Web Dashboard Demo](https://github.com/gluesql/gluesql-js-demo)
52
-
53
- ## :books: Features
29
+ ## Usage
54
30
 
55
- ### :green_book: Supported Queries
56
- * `CREATE TABLE`
57
- * `ALTER TABLE`
58
- * `INSERT`
59
- * `UPDATE`
60
- * `SELECT`
61
- * `DELETE`
62
- * `DROP TABLE`
63
-
64
- ### :blue_book: Supported Data Types & Attributes
65
- #### Types
66
- * `INTEGER`
67
- * `FLOAT`
68
- * `BOOLEAN`
69
- * `TEXT`
70
-
71
- #### Attributes
72
- * `NULL` | `NOT NULL`
31
+ ```javascript
32
+ import { gluesql } from 'gluesql';
73
33
 
74
- > Example
75
- ```sql
76
- CREATE TABLE User (
77
- id INTEGER,
78
- name TEXT NULL,
79
- valid BOOLEAN
80
- );
81
- ```
34
+ const db = await gluesql();
82
35
 
83
- ### :orange_book: Supported SQL Syntax Keywords
84
- #### Join (only with `ON` keyword)
85
- * `INNER JOIN` | `JOIN`
86
- * `LEFT JOIN` | `LEFT OUTER JOIN`
36
+ db.query(`
37
+ CREATE TABLE User (id INTEGER, name TEXT);
38
+ INSERT INTO User VALUES (1, "Hello"), (2, "World");
39
+ `);
87
40
 
88
- > Example
89
- ```sql
90
- SELECT * FROM TableA
91
- JOIN TableB ON TableB.a_id = TableA.id
92
- WHERE TableA.id > 10;
93
- ```
41
+ const [{ rows }] = await db.query('SELECT * FROM User;');
94
42
 
95
- #### NestedSelect
96
- > Example
97
- ```sql
98
- SELECT * FROM User
99
- WHERE User.id IN (SELECT id IN Other);
43
+ console.log(rows);
100
44
  ```
101
45
 
102
- #### Aggregation
103
- * `COUNT`
104
- * `MAX`
105
- * `MIN`
106
- * `SUM`
107
- * `GROUP BY`, `HAVING`
46
+ ## Examples
47
+ * [JavaScript modules](https://github.com/gluesql/gluesql/tree/main/gluesql-js/examples/web/module)
48
+ * [Rollup](https://github.com/gluesql/gluesql/tree/main/gluesql-js/examples/web/rollup)
49
+ * [Webpack](https://github.com/gluesql/gluesql/tree/main/gluesql-js/examples/web/rollup)
50
+ * [Node.js](https://github.com/gluesql/gluesql/tree/main/gluesql-js/examples/nodejs)
108
51
 
109
- > Example
110
- ```sql
111
- SELECT
112
- COUNT(*),
113
- MAX(amount) + MIN(amount),
114
- SUM(amount)
115
- FROM TableA
116
- GROUP BY city
117
- HAVING COUNT(*) > 10;
118
- ```
52
+ ## 🚧 Documentation- WIP
53
+ * [General examples](https://github.com/gluesql/gluesql/tree/main/test-suite/src)
54
+ * [Supported data types](https://github.com/gluesql/gluesql/tree/main/test-suite/src/data_type)
55
+ * [Supported SQL functions](https://github.com/gluesql/gluesql/tree/main/test-suite/src/function)