6.7.0-alpha.0 • Published 6 months ago
@react-awesome-query-builder/sql v6.7.0-alpha.0
@react-awesome-query-builder/sql
This packages provides import from SQL using node-sql-parser
Installation
Install:
npm i @react-awesome-query-builder/sql --saveUsage
import { Utils } from '@react-awesome-query-builder/core';
import { SqlUtils } from "@react-awesome-query-builder/sql";
const importFromSql = (sqlStr) => {
const {tree, errors: sqlErrors, warnings: sqlWarnings} = SqlUtils.loadFromSql(sqlStr, state.config);
if (sqlErrors.length) {
console.log("Import errors: ", sqlErrors);
}
const {fixedTree} = Utils.sanitizeTree(tree, state.config);
setState({
...state,
tree: fixedTree,
});
};