npm packages

This commit is contained in:
Jan Prochazka 2020-11-17 08:27:14 +01:00
parent b51a343323
commit a3a4923397
4 changed files with 37 additions and 17 deletions

View File

@ -28,6 +28,21 @@ dbgateApi.runScript(run);
```
Silly example, runs without any dependencies. Copy [fakeObjectReader](https://github.com/dbshell/dbgate/blob/master/packages/api/src/shell/fakeObjectReader.js) to [consoleObjectWriter](https://github.com/dbshell/dbgate/blob/master/packages/api/src/shell/consoleObjectWriter.js) .
```javascript
const dbgateApi = require('dbgate-api');
async function run() {
const reader = await dbgateApi.fakeObjectReader();
const writer = await dbgateApi.consoleObjectWriter();
await dbgateApi.copyStream(reader, writer);
console.log('Finished job script');
}
dbgateApi.runScript(run);
```
## dbgateApi functions
### dbgateApi.copyStream

View File

@ -1,7 +1,7 @@
{
"name": "dbgate-api",
"main": "src/index.js",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://dbgate.org/",
"repository": {

View File

@ -7,33 +7,38 @@ dbgate-sqltree hold query definition in RAW JSON objects.
## Sample usage
```javascript
const { treeToSql, dumpSqlSelect } = require('dbgate-sqltree');
const engines = require('dbgate-engines');
const { treeToSql, dumpSqlSelect } = require("dbgate-sqltree");
const engines = require("dbgate-engines");
const select = {
commandType: 'select',
from: { name: 'Album' },
commandType: "select",
from: {
name: {
pureName: "Album",
},
},
columns: [
{
exprType: 'column',
columnName: 'name',
}
]
})),
{
exprType: "column",
columnName: "name",
},
],
orderBy: [
{
exprType: 'column',
columnName: 'id',
direction: 'ASC',
exprType: "column",
columnName: "id",
direction: "ASC",
},
],
};
const sql = treeToSql(engines('mysql'), select, dumpSqlSelect);
console.log('Generated SQL', sqll);
const sql = treeToSql(engines("mysql"), select, dumpSqlSelect);
console.log("Generated query:", sql);
```
See [TypeScript definitions](https://github.com/dbshell/dbgate/blob/master/packages/sqltree/src/types.ts) for complete list of available SQL command options.
## Installation
yarn add dbgate-sqltree

View File

@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.0.2",
"name": "dbgate-sqltree",
"main": "lib/index.js",
"typings": "lib/index.d.ts",