mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
20 lines
456 B
TypeScript
20 lines
456 B
TypeScript
import { Parser } from 'node-sql-parser';
|
|
|
|
const parser = new Parser();
|
|
const sql = 'select id from tableA';
|
|
|
|
// $ExpectType Select | Insert_Replace | Update | Delete | AST[]
|
|
const selectAst = parser.astify(sql);
|
|
|
|
// $ExpectType string
|
|
parser.sqlify(selectAst);
|
|
|
|
// $ExpectType string[]
|
|
parser.tableList(sql);
|
|
|
|
// $ExpectType string[]
|
|
parser.columnList(sql);
|
|
|
|
// $ExpectType Error | undefined
|
|
parser.whiteListCheck(sql, ['select::null::tableA'], 'table');
|