mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 23:46:23 +00:00
readme
This commit is contained in:
39
packages/sqltree/README.md
Normal file
39
packages/sqltree/README.md
Normal 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
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user