Skip to content

Commit c75da56

Browse files
committed
🐛 setup deno package
0 parents  commit c75da56

File tree

9 files changed

+1082
-0
lines changed

9 files changed

+1082
-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 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 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: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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 (PostgreSQL).
2+
3+
4+
📦 [JSR](https://jsr.io/@nodef/extra-sql),
5+
📰 [Docs](https://jsr.io/@nodef/extra-sql/doc),
6+
7+
<br>
8+
9+
10+
```javascript
11+
import * as xsql from "jsr:@nodef/extra-sql";
12+
13+
xsql.tableExists("food");
14+
// → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
15+
16+
xsql.setupTable("food", {code: "TEXT", name: "TEXT"},
17+
[{code: "F1", name: "Mango"}, {code: "F2", name: "Lychee"}]);
18+
// → CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
19+
// → INSERT INTO "food" ("code", "name") VALUES
20+
// → ($$F1$$, $$Mango$$),
21+
// → ($$F2$$, $$Lychee$$);
22+
23+
24+
xsql.selectTsquery("columns", "total fat");
25+
// → SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
26+
27+
xsql.matchTsquery("columns", ["total", "fat"]);
28+
// → SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
29+
// → SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
30+
```
31+
32+
33+
## Index
34+
35+
| Name | Description |
36+
| ---- | ------ |
37+
| [createTable] | Generate SQL command for CREATE TABLE. |
38+
| [createIndex] | Generate SQL command for CREATE INDEX. |
39+
| [createView] | Generate SQL command for CREATE VIEW. |
40+
| [insertInto] | Generates SQL command for INSERT INTO using an array of values. |
41+
| [setupTable] | Generate SQL commands to set up a table (create, insert, index). |
42+
| [tableExists] | Generate SQL command to check if a table exists. |
43+
| [selectTsquery] | Generate SQL command for SELECT with tsquery. |
44+
| [matchTsquery] | Generate SQL query for matching words with tsquery. |
45+
| [insertIntoStream] | Generate SQL command for INSERT INTO using a stream of values. |
46+
| [setupTableIndex] | Generate SQL commands for setting up table indexes and views. |
47+
| [createTableData] | Generate SQL command for creating a table with data. |
48+
| [updateData] | Generate SQL command for updating data. |
49+
| [selectData] | Generate SQL command for selecting data. |
50+
| [insertIntoData] | Generate SQL command for inserting data. |
51+
| [deleteData] | Generate SQL command for deleting data. |
52+
| [OPERATORS] | Set of operators in SQL. {field} |
53+
| [OPERAND_COUNT] | Number of operands used with an SQL operator. {field} |
54+
55+
<br>
56+
<br>
57+
58+
59+
[![](https://raw.githubusercontent.com/qb40/designs/gh-pages/0/image/11.png)](https://wolfram77.github.io)<br>
60+
[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)
61+
![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-sql)
62+
63+
64+
[SQL]: https://en.wikipedia.org/wiki/SQL
65+
[createTable]: https://jsr.io/@nodef/extra-sql/doc/~/createTable
66+
[createIndex]: https://jsr.io/@nodef/extra-sql/doc/~/createIndex
67+
[createView]: https://jsr.io/@nodef/extra-sql/doc/~/createView
68+
[insertInto]: https://jsr.io/@nodef/extra-sql/doc/~/insertInto
69+
[setupTable]: https://jsr.io/@nodef/extra-sql/doc/~/setupTable
70+
[tableExists]: https://jsr.io/@nodef/extra-sql/doc/~/tableExists
71+
[selectTsquery]: https://jsr.io/@nodef/extra-sql/doc/~/selectTsquery
72+
[matchTsquery]: https://jsr.io/@nodef/extra-sql/doc/~/matchTsquery
73+
[OPERATORS]: https://jsr.io/@nodef/extra-sql/doc/~/OPERATORS
74+
[OPERAND_COUNT]: https://jsr.io/@nodef/extra-sql/doc/~/OPERAND_COUNT
75+
[insertIntoStream]: https://jsr.io/@nodef/extra-sql/doc/~/insertIntoStream
76+
[setupTableIndex]: https://jsr.io/@nodef/extra-sql/doc/~/setupTableIndex
77+
[createTableData]: https://jsr.io/@nodef/extra-sql/doc/~/createTableData
78+
[updateData]: https://jsr.io/@nodef/extra-sql/doc/~/updateData
79+
[selectData]: https://jsr.io/@nodef/extra-sql/doc/~/selectData
80+
[insertIntoData]: https://jsr.io/@nodef/extra-sql/doc/~/insertIntoData
81+
[deleteData]: https://jsr.io/@nodef/extra-sql/doc/~/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.1.1",
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)