dbgate/packages/sqltree
Jan Prochazka 2a032dfc33 readme
2020-11-16 21:35:18 +01:00
..
src grouping - work with datetimes 2020-06-21 21:44:54 +02:00
.gitignore introduced sqltree typescript library 2020-03-05 07:35:23 +01:00
package.json readme 2020-11-16 21:35:18 +01:00
README.md readme 2020-11-16 21:35:18 +01:00
tsconfig.json packages, documentation 2020-03-13 22:42:09 +01:00

@dbgate/sqltree

JavaScript/TypeScript SQL query-builder library

@dbgate/sqltree hold query definition in RAW JSON objects.

Sample usage

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