diff --git a/.github/workflows/build-npm.yaml b/.github/workflows/build-npm.yaml index 3d2231af..4757c13c 100644 --- a/.github/workflows/build-npm.yaml +++ b/.github/workflows/build-npm.yaml @@ -79,6 +79,11 @@ jobs: run: | npm publish + - name: Publish query-splitter + working-directory: packages/query-splitter + run: | + npm publish + - name: Publish web working-directory: packages/web run: | diff --git a/packages/query-splitter/README.md b/packages/query-splitter/README.md new file mode 100644 index 00000000..a3933ec0 --- /dev/null +++ b/packages/query-splitter/README.md @@ -0,0 +1,34 @@ +dbgate-query-splitter +==================== + +Splits long SQL query into into particular statements. Designed to have zero dependencies and to be fast. + +Supports following SQL dialects: +* MySQL +* PostgreSQL +* SQLite +* Microsoft SQL Server + +## Usage + +```js +import { splitQuery, mysqlSplitterOptions, mssqlSplitterOptions, postgreSplitterOptions } from 'dbgate-query-splitter'; + +const output = splitQuery('SELECT * FROM `table1`;SELECT * FROM `table2`;', mysqlSplitterOptions); + +// output is ['SELECT * FROM `table1`', 'SELECT * FROM `table2`'] + +``` + +## Contributing +Please run tests before pushing any changes. + +```sh +yarn test +``` + +## Supported syntax +* Comments +* Dollar strings (PostgreSQL) +* GO separators (MS SQL) +* Custom delimiter, setby DELIMITER keyword (MySQL) diff --git a/packages/query-splitter/package.json b/packages/query-splitter/package.json index 128cc867..e4668e6e 100644 --- a/packages/query-splitter/package.json +++ b/packages/query-splitter/package.json @@ -3,6 +3,20 @@ "name": "dbgate-query-splitter", "main": "lib/index.js", "typings": "lib/index.d.ts", + "description": "SQL Query splitter for verious database engines", + "homepage": "https://github.com/dbgate/dbgate/tree/master/packages/query-splitter", + "repository": { + "type": "git", + "url": "https://github.com/dbgate/dbgate" + }, + "author": "Jan Prochazka", + "license": "MIT", + "keywords": [ + "SQL", + "query", + "split", + "parse" + ], "scripts": { "build": "tsc", "start": "tsc --watch", @@ -19,8 +33,5 @@ "jest": "^24.9.0", "ts-jest": "^25.2.1", "typescript": "^3.7.5" - }, - "dependencies": { - "lodash": "^4.17.21" } } \ No newline at end of file diff --git a/setCurrentVersion.js b/setCurrentVersion.js index a774f489..09d879a0 100644 --- a/setCurrentVersion.js +++ b/setCurrentVersion.js @@ -39,6 +39,7 @@ changePackageFile('packages/web', json.version); changePackageFile('packages/datalib', json.version); changePackageFile('packages/dbgate', json.version); changePackageFile('packages/filterparser', json.version); +changePackageFile('packages/query-splitter', json.version); changePackageFile('plugins/dbgate-plugin-csv', json.version); changePackageFile('plugins/dbgate-plugin-excel', json.version);