query-splitter - documentation, publish

This commit is contained in:
Jan Prochazka 2021-06-03 07:40:35 +02:00
parent 5d661ad3a3
commit 64c7072aca
4 changed files with 54 additions and 3 deletions

View File

@ -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: |

View File

@ -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)

View File

@ -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"
}
}

View File

@ -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);