sql-comment-parser
v1.0.1
Published
Parser for google/sqlcommenter comments
Downloads
7
Maintainers
Readme
SQL Comment parser
Parser for google/sqlcommenter comments
Install
npm install sql-comment-parser
Usage
import { parse } from 'sql-comment-parser';
const { query, comments } = parse("SELECT * FROM FOO /*action='%2Fparam*d',controller='index',framework='spring',traceparent='00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01',tracestate='congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7'*/");
//=> query: "SELECT * FROM FOO"
//=> comments: { action: "/param*d", controller: "index", framework: "spring", traceparent: "00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01", tracestate: "congo=t61rcWkgMzE,rojo=00f067aa0ba902b7" }
The input may or may not include a valid sql comment. This parser will not check the validity of the input and will do a best effort.