Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nodef/extra-sql
SQL is designed for managing or stream processing data in an RDBMS.
https://github.com/nodef/extra-sql
create exists extra index insert into match select setup sql table tsquery view
Last synced: about 1 month ago
JSON representation
SQL is designed for managing or stream processing data in an RDBMS.
- Host: GitHub
- URL: https://github.com/nodef/extra-sql
- Owner: nodef
- License: mit
- Created: 2018-05-23T10:20:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T21:18:20.000Z (almost 5 years ago)
- Last Synced: 2024-10-29T15:33:17.502Z (2 months ago)
- Topics: create, exists, extra, index, insert, into, match, select, setup, sql, table, tsquery, view
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/extra-sql
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[SQL] is designed for managing or stream processing data in an RDBMS.
Includes SQL command generation functions, with a few for text matching (PostgreSQL).```javascript
const sql = require('extra-sql');sql.tableExists('food');
// SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');sql.setupTable('food', {code: 'TEXT', name: 'TEXT'},
[{code: 'F1', name: 'Mango'}, {code: 'F2', name: 'Lychee'}]);
// CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
// INSERT INTO "food" ("code", "name") VALUES
// ('F1', 'Mango'),
// ('F2', 'Lychee');sql.selectTsquery('columns', 'total fat');
// SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');sql.matchTsquery('columns', ['total', 'fat']);
// SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
// SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
```### reference
| Name | Action
|---------------------|-------
| [createTable] | Generates SQL command for CREATE TABLE.
| [createIndex] | Generates SQL command for CREATE INDEX.
| [createView] | Generates SQL command for CREATE VIEW.
| [insertInto] | Generates SQL command for INSERT INTO.
| [setupTable] | Generates SQL commands to setup table (create, insert, index).
| [tableExists] | Generates SQL command for table exists check.
| [selectTsquery] | Generates SQL command for SELECT with tsquery.
| [matchTsquery] | Generates SQL query for matching words with tsquery.
| [OPERATORS] | Set of operators in SQL. {field}
| [OPERAND_COUNT] | Number of operands used with an SQL operator. {field}
[![nodef](https://merferry.glitch.me/card/extra-sql.svg)](https://nodef.github.io)
[createTable]: https://github.com/nodef/extra-sql/wiki/createTable
[createIndex]: https://github.com/nodef/extra-sql/wiki/createIndex
[createView]: https://github.com/nodef/extra-sql/wiki/createView
[insertInto]: https://github.com/nodef/extra-sql/wiki/insertInto
[setupTable]: https://github.com/nodef/extra-sql/wiki/setupTable
[tableExists]: https://github.com/nodef/extra-sql/wiki/tableExists
[selectTsquery]: https://github.com/nodef/extra-sql/wiki/selectTsquery
[matchTsquery]: https://github.com/nodef/extra-sql/wiki/matchTsquery
[OPERATORS]: https://github.com/nodef/extra-sql/wiki/OPERATORS
[OPERAND_COUNT]: https://github.com/nodef/extra-sql/wiki/OPERAND_COUNT
[SQL]: https://en.wikipedia.org/wiki/SQL