Skip to content

Commit fff090e

Browse files
committed
operators added
1 parent a043de7 commit fff090e

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ sql.matchTsquery('columns', ['total', 'fat']);
3434
| [tableExists] | Generates SQL command for table exists check.
3535
| [selectTsquery] | Generates SQL command for SELECT with tsquery.
3636
| [matchTsquery] | Generates SQL query for matching words with tsquery.
37+
| [OPERATORS] | Set of operators in SQL. {field}
3738

3839
<br>
3940
<br>

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* Set of operators in SQL.
3+
*/
4+
const OPERATORS = new Set([
5+
// arithmetic operators
6+
'+', '-', '*', '/', '%',
7+
// bitwise operators
8+
'&', '|', '^',
9+
// comparision operators
10+
'=', '>', '<', '>=', '<=', '<>',
11+
// compound operators
12+
'+=', '-=', '*=', '/=', '%=', '&=', '^=', '|=',
13+
// logical operators
14+
'ALL', 'AND', 'ANY', 'BETWEEN', 'EXISTS', 'IN', 'IN', 'LIKE', 'NOT', 'OR', 'SOME'
15+
]);
16+
17+
118
/**
219
* Generates SQL command for CREATE TABLE.
320
* @param {string} nam table name
@@ -202,6 +219,7 @@ function matchTsquery(tab, wrds, tsv='"tsvector"', opt={}) {
202219
z += ';\n';
203220
return z;
204221
}
222+
exports.OPERATORS = OPERATORS;
205223
exports.createTable = createTable;
206224
exports.createIndex = createIndex;
207225
exports.createView = createView;

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "extra-sql",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "SQL is designed for managing or stream processing data in an RDBMS.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)