mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
.. | ||
src | ||
.gitignore | ||
package.json | ||
README.md | ||
tsconfig.json |
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