Skip to content

Commit dc097df

Browse files
committed
🐛 upgrade package (2025)
1 parent 3df61ef commit dc097df

File tree

15 files changed

+6137
-339
lines changed

15 files changed

+6137
-339
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
tags:
8+
- '!*' # Do not execute on tags
9+
env:
10+
NAME: ${{vars.NAME}}
11+
EMAIL: ${{vars.EMAIL}}
12+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
13+
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
14+
QLTY_COVERAGE_TOKEN: ${{secrets.QLTY_COVERAGE_TOKEN}}
15+
FORCE_COLOR: 1
16+
17+
18+
jobs:
19+
test:
20+
strategy:
21+
matrix:
22+
platform: [ubuntu-latest, windows-latest, macOS-latest]
23+
node: [20.x, 22.x]
24+
name: Test with Node ${{matrix.node}} on ${{matrix.platform}}
25+
runs-on: ${{matrix.platform}}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: ${{matrix.node}}
31+
- run: npm ci
32+
- run: npm test
33+
34+
35+
coverage:
36+
name: Publish coverage
37+
needs: [test]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-node@v3
42+
with:
43+
node-version: 22.x
44+
- run: npm ci
45+
- run: npm test
46+
- uses: qltysh/qlty-action/coverage@main
47+
with:
48+
coverage-token: ${{secrets.QLTY_COVERAGE_TOKEN}}
49+
files: coverage/lcov.info
50+
51+
52+
docs:
53+
name: Publish docs
54+
needs: [test]
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-node@v3
59+
with:
60+
node-version: 22.x
61+
- uses: nodef/git-config.action@v1.0.0
62+
- run: npm i -g typescript typedoc
63+
- run: npm ci
64+
- run: npm run publish-docs
65+
66+
67+
packages:
68+
name: Publish packages
69+
needs: [test]
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: actions/setup-node@v3
74+
with:
75+
node-version: 22.x
76+
- uses: nodef/npm-config.action@v1.0.0
77+
with:
78+
entries: access = public
79+
- run: npm i -g typescript rollup typedoc browserify terser
80+
- run: npm ci
81+
- run: npm run publish-packages

.github/workflows/pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: PR
2+
on: [pull_request]
3+
env:
4+
FORCE_COLOR: 1
5+
6+
7+
jobs:
8+
test:
9+
strategy:
10+
matrix:
11+
platform: [ubuntu-latest, windows-latest, macOS-latest]
12+
node: [20.x, 22.x]
13+
name: Test with Node ${{ matrix.node }} on ${{ matrix.platform }}
14+
runs-on: ${{ matrix.platform }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node }}
20+
- run: npm ci
21+
- run: npm test

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Generated files
2+
.build/
3+
.docs/
4+
coverage/
5+
*.d.ts
6+
*.map
7+
example.js
8+
index.js
9+
index.?js
10+
111
# Logs
212
logs
313
*.log

.npmignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Source only
2+
.gitmodules
3+
.github/
4+
.docs/
5+
src/
6+
data/
7+
wiki/
8+
tests/
9+
unused/
10+
test.js
11+
CITATION.cff
12+
TODO
13+
14+
# Build
15+
.build/
16+
coverage/
17+
.travis.yml
18+
.coveralls.yml
19+
tsconfig.json
20+
jest.config.js
21+
rollup.config.js
22+
build.js

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-20 Subhajit Sahu
3+
Copyright (c) 2018-25 Subhajit Sahu
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,69 @@
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

Comments
 (0)