Skip to content

Commit ed5e536

Browse files
committed
🐛 setup deno package
0 parents  commit ed5e536

File tree

9 files changed

+1085
-0
lines changed

9 files changed

+1085
-0
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
FORCE_COLOR: 1
15+
16+
17+
jobs:
18+
test:
19+
strategy:
20+
matrix:
21+
platform: [ubuntu-latest, windows-latest, macOS-latest]
22+
name: Test with Deno on ${{matrix.platform}}
23+
runs-on: ${{matrix.platform}}
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: denoland/setup-deno@v2
27+
with:
28+
deno-version: v2.x
29+
- run: deno test
30+
31+
32+
publish:
33+
name: Publish package
34+
needs: [test]
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
id-token: write
39+
steps:
40+
- uses: actions/checkout@v4
41+
- run: npx jsr publish

.github/workflows/pr.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
name: Test with Deno on ${{matrix.platform}}
13+
runs-on: ${{matrix.platform}}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: denoland/setup-deno@v2
17+
with:
18+
deno-version: v2.x
19+
- run: deno test

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Generated files
2+
.build/
3+
.docs/
4+
coverage/
5+
*.d.ts
6+
*.map
7+
example.js
8+
index.js
9+
index.?js
10+
11+
# Logs
12+
logs
13+
*.log
14+
15+
16+
*.orig
17+
*.pyc
18+
*.swp
19+
.env
20+
21+
/.cargo_home/
22+
/.idea/
23+
/.vs/
24+
/.vscode/
25+
gclient_config.py_entries
26+
/target/
27+
/std/hash/_wasm/target
28+
/tests/wpt/runner/manifest.json
29+
/third_party/
30+
/tests/napi/node_modules
31+
/tests/napi/build
32+
/tests/napi/third_party_tests/node_modules
33+
34+
# MacOS generated files
35+
.DS_Store
36+
.DS_Store?
37+
38+
# Flamegraphs
39+
/flamebench*.svg
40+
/flamegraph*.svg
41+
42+
# WPT generated cert files
43+
/tests/wpt/runner/certs/index.txt*
44+
/tests/wpt/runner/certs/serial*
45+
46+
/ext/websocket/autobahn/reports
47+
48+
# JUnit files produced by deno test --junit
49+
junit.xml
50+
51+
# Jupyter files
52+
.ipynb_checkpoints/
53+
Untitled*.ipynb
54+
55+
# playwright browser binary cache
56+
/.ms-playwright

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-25 Subhajit Sahu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
12+
13+
```javascript
14+
import * as xsql from 'extra-sql';
15+
16+
xsql.tableExists('food');
17+
// → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
18+
19+
xsql.setupTable('food', {code: 'TEXT', name: 'TEXT'},
20+
[{code: 'F1', name: 'Mango'}, {code: 'F2', name: '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+
26+
27+
xsql.selectTsquery('columns', 'total fat');
28+
// → SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
29+
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');
33+
```
34+
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} |
57+
58+
<br>
59+
<br>
60+
61+
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+
![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-sql)
65+
66+
67+
[SQL]: https://en.wikipedia.org/wiki/SQL
68+
[createTable]: https://github.com/nodef/extra-sql/wiki/createTable
69+
[createIndex]: https://github.com/nodef/extra-sql/wiki/createIndex
70+
[createView]: https://github.com/nodef/extra-sql/wiki/createView
71+
[insertInto]: https://github.com/nodef/extra-sql/wiki/insertInto
72+
[setupTable]: https://github.com/nodef/extra-sql/wiki/setupTable
73+
[tableExists]: https://github.com/nodef/extra-sql/wiki/tableExists
74+
[selectTsquery]: https://github.com/nodef/extra-sql/wiki/selectTsquery
75+
[matchTsquery]: https://github.com/nodef/extra-sql/wiki/matchTsquery
76+
[OPERATORS]: https://github.com/nodef/extra-sql/wiki/OPERATORS
77+
[OPERAND_COUNT]: https://github.com/nodef/extra-sql/wiki/OPERAND_COUNT
78+
[insertIntoStream]: https://github.com/nodef/extra-sql/wiki/insertIntoStream
79+
[setupTableIndex]: https://github.com/nodef/extra-sql/wiki/setupTableIndex
80+
[createTableData]: https://github.com/nodef/extra-sql/wiki/createTableData
81+
[updateData]: https://github.com/nodef/extra-sql/wiki/updateData
82+
[selectData]: https://github.com/nodef/extra-sql/wiki/selectData
83+
[insertIntoData]: https://github.com/nodef/extra-sql/wiki/insertIntoData
84+
[deleteData]: https://github.com/nodef/extra-sql/wiki/deleteData

deno.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@nodef/extra-sql",
3+
"version": "0.0.4",
4+
"license": "MIT",
5+
"exports": "./index.ts"
6+
}

deno.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)