1- [ SQL] is designed for managing or stream processing data in an RDBMS.
2- Includes SQL command generation functions, with a few for text matching (PostgreSQL).
1+ [ SQL] is designed for managing or stream processing data in an RDBMS. This package provides a set of functions to generate SQL commands for creating tables, inserting data, and performing various operations, including text search and matching, on SQL databases (currently PostgreSQL).
2+
3+ ▌
4+ 📦 [ Node.js] ( https://www.npmjs.com/package/extra-sql ) ,
5+ 🌐 [ Web] ( https://www.npmjs.com/package/extra-sql.web ) ,
6+ 📜 [ Files] ( https://unpkg.com/extra-sql/ ) ,
7+ 📰 [ Docs] ( https://nodef.github.io/extra-sql/ ) ,
8+ 📘 [ Wiki] ( https://github.com/nodef/extra-sql/wiki/ ) .
9+
10+ <br >
11+
312
413``` javascript
5- const sql = require ( ' extra-sql' ) ;
14+ import * as xsql from ' extra-sql' ;
615
7- sql .tableExists (' food' );
8- // SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
16+ xsql .tableExists (' food' );
17+ // → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
918
10- sql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
19+ xsql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
1120 [{code: ' F1' , name: ' Mango' }, {code: ' F2' , name: ' Lychee' }]);
12- // CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
13- // INSERT INTO "food" ("code", "name") VALUES
14- // ('F1', 'Mango'),
15- // ('F2', 'Lychee');
21+ // → CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
22+ // → INSERT INTO "food" ("code", "name") VALUES
23+ // → ($$F1$$, $$Mango$$),
24+ // → ($$F2$$, $$Lychee$$);
25+
1626
17- sql .selectTsquery (' columns' , ' total fat' );
18- // SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
27+ xsql .selectTsquery (' columns' , ' total fat' );
28+ // → SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
1929
20- sql .matchTsquery (' columns' , [' total' , ' fat' ]);
21- // SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
22- // SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
30+ xsql .matchTsquery (' columns' , [' total' , ' fat' ]);
31+ // → SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
32+ // → SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
2333```
2434
25- ### reference
26-
27- | Name | Action
28- |---------------------|-------
29- | [ createTable] | Generates SQL command for CREATE TABLE.
30- | [ createIndex] | Generates SQL command for CREATE INDEX.
31- | [ createView] | Generates SQL command for CREATE VIEW.
32- | [ insertInto] | Generates SQL command for INSERT INTO.
33- | [ setupTable] | Generates SQL commands to setup table (create, insert, index).
34- | [ tableExists] | Generates SQL command for table exists check.
35- | [ selectTsquery] | Generates SQL command for SELECT with tsquery.
36- | [ matchTsquery] | Generates SQL query for matching words with tsquery.
37- | [ OPERATORS] | Set of operators in SQL. {field}
38- | [ OPERAND_COUNT] | Number of operands used with an SQL operator. {field}
35+
36+ ## Index
37+
38+ | Property | Description |
39+ | ---- | ---- |
40+ | [ createTable] | Generate SQL command for CREATE TABLE. |
41+ | [ createIndex] | Generate SQL command for CREATE INDEX. |
42+ | [ createView] | Generate SQL command for CREATE VIEW. |
43+ | [ insertInto] | Generates SQL command for INSERT INTO using an array of values. |
44+ | [ setupTable] | Generate SQL commands to set up a table (create, insert, index). |
45+ | [ tableExists] | Generate SQL command to check if a table exists. |
46+ | [ selectTsquery] | Generate SQL command for SELECT with tsquery. |
47+ | [ matchTsquery] | Generate SQL query for matching words with tsquery. |
48+ | [ insertIntoStream] | Generate SQL command for INSERT INTO using a stream of values. |
49+ | [ setupTableIndex] | Generate SQL commands for setting up table indexes and views. |
50+ | [ createTableData] | Generate SQL command for creating a table with data. |
51+ | [ updateData] | Generate SQL command for updating data. |
52+ | [ selectData] | Generate SQL command for selecting data. |
53+ | [ insertIntoData] | Generate SQL command for inserting data. |
54+ | [ deleteData] | Generate SQL command for deleting data. |
55+ | [ OPERATORS] | Set of operators in SQL. {field} |
56+ | [ OPERAND_COUNT] | Number of operands used with an SQL operator. {field} |
3957
4058<br >
4159<br >
4260
43- [ ![ nodef] ( https://merferry.glitch.me/card/extra-sql.svg )] ( https://nodef.github.io )
4461
62+ [ ![ ] ( https://img.youtube.com/vi/u6EuAUjq92k/maxresdefault.jpg )] ( https://www.youtube.com/watch?v=u6EuAUjq92k ) <br >
63+ [ ![ ORG] ( https://img.shields.io/badge/org-nodef-green?logo=Org )] ( https://nodef.github.io )
64+
65+
66+ [ SQL ] : https://en.wikipedia.org/wiki/SQL
4567[ createTable ] : https://github.com/nodef/extra-sql/wiki/createTable
4668[ createIndex ] : https://github.com/nodef/extra-sql/wiki/createIndex
4769[ createView ] : https://github.com/nodef/extra-sql/wiki/createView
@@ -52,4 +74,10 @@ sql.matchTsquery('columns', ['total', 'fat']);
5274[ matchTsquery ] : https://github.com/nodef/extra-sql/wiki/matchTsquery
5375[ OPERATORS ] : https://github.com/nodef/extra-sql/wiki/OPERATORS
5476[ OPERAND_COUNT ] : https://github.com/nodef/extra-sql/wiki/OPERAND_COUNT
55- [ SQL ] : https://en.wikipedia.org/wiki/SQL
77+ [ insertIntoStream ] : https://github.com/nodef/extra-sql/wiki/insertIntoStream
78+ [ setupTableIndex ] : https://github.com/nodef/extra-sql/wiki/setupTableIndex
79+ [ createTableData ] : https://github.com/nodef/extra-sql/wiki/createTableData
80+ [ updateData ] : https://github.com/nodef/extra-sql/wiki/updateData
81+ [ selectData ] : https://github.com/nodef/extra-sql/wiki/selectData
82+ [ insertIntoData ] : https://github.com/nodef/extra-sql/wiki/insertIntoData
83+ [ deleteData ] : https://github.com/nodef/extra-sql/wiki/deleteData
0 commit comments