This commit is contained in:
Jan Prochazka
2020-11-16 21:35:18 +01:00
parent 5384677c6c
commit 2a032dfc33
11 changed files with 98 additions and 24 deletions

View File

@@ -0,0 +1,39 @@
# @dbgate/sqltree
JavaScript/TypeScript SQL query-builder library
@dbgate/sqltree hold query definition in RAW JSON objects.
## Sample usage
```javascript
const { treeToSql, dumpSqlSelect } = require('@dbgate/sqltree');
const engines = require('@dbgate/engines');
const select = {
commandType: 'select',
from: { name: 'Album' },
columns: [
{
exprType: 'column',
columnName: 'name',
}
]
})),
orderBy: [
{
exprType: 'column',
columnName: 'id',
direction: 'ASC',
},
],
};
const sql = treeToSql(engines('mysql'), select, dumpSqlSelect);
console.log('Generated SQL', sqll);
```
## Installation
yarn add @dbgate/sqltree

View File

@@ -1,8 +1,18 @@
{
"version": "0.1.0",
"version": "1.0.0",
"name": "@dbgate/sqltree",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"homepage": "https://dbgate.org/",
"repository": {
"type": "git",
"url": "https://github.com/dbshell/dbgate.git"
},
"funding": "https://www.paypal.com/paypalme/JanProchazkaCz/30eur",
"author": "Jan Prochazka",
"license": "GPL",
"scripts": {
"prepare": "yarn build",
"build": "tsc",
@@ -12,7 +22,7 @@
"lib"
],
"devDependencies": {
"@dbgate/types": "^0.1.0",
"@dbgate/types": "^1.0.0",
"@types/node": "^13.7.0",
"typescript": "^3.7.5"
}