db-query-parser
Helper to parse and manage string sql queries
Instalation
install with npm
npm install jelly-db-query-parser
install with yarn
yarn add jelly-db-query-parser
Documentation
Parse script using position 0 of cursor
;const query: string = 'select * from mytable; insert into mytable ("col1") VALUES("blablabla") select * from mytable2;table2;';const q: string = ParserController;console; // select * from mytable
Parse script using position of cursor from 0 until 22 (selected text with mouse)
const q: string = ParserController;console; // select * from mytable;
Parse script using position 23 of cursor
const q: string = ParserController;console; // insert into mytable ("col1") VALUES("blablabla") select * from mytable2
Search table
const tables: string = ;tables;tables;tables;HelperController;HelperController;const result: string = HelperController;console; // ['table_1', 'table_2', 'table_3']result = HelperController;console; // ['table_2']
Search snippet
const result: string = HelperController;console; // ['select * from $1']result = HelperController;console; // ['select * from tablexpto']
Identify tags and get colors
const result: any = IdentifierController;console; // {tag: 'select', color: 'blue'}const color: string = IdentifierController;console; // 'blue'
Roadmap
- Add query parser to identify selected query block (Done)
- Add tables, columns quick search (Done)
- Add snippets with quick search (Done)
- Snippets with properties replace (Done)
- Identify tags, and assign properties, like color (Done)
- SQL validator (Backlog)
About
Created with ♥️ by @pedroladeira in Portugal, thanks to other contributors