UNPKG

rawsql-ts

Version:

[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

38 lines 1.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SqlFormatter = exports.Formatter = void 0; const SqlFormatter_1 = require("./SqlFormatter"); Object.defineProperty(exports, "SqlFormatter", { enumerable: true, get: function () { return SqlFormatter_1.SqlFormatter; } }); /** * @deprecated The Formatter class is deprecated. Use SqlFormatter instead. */ class Formatter { constructor() { this.sqlFormatter = new SqlFormatter_1.SqlFormatter({ identifierEscape: { start: '"', end: '"' }, parameterSymbol: ':', parameterStyle: 'named' // Default to 'named' for backward compatibility }); } format(arg, config = null) { // Use the sqlFormatter instance to format the SQL component if (config) { this.sqlFormatter = new SqlFormatter_1.SqlFormatter(config); } const result = this.sqlFormatter.format(arg); return result.formattedSql; } formatWithParameters(arg, config = null) { // Use the sqlFormatter instance to format the SQL component with parameters if (config) { this.sqlFormatter = new SqlFormatter_1.SqlFormatter(config); } const result = this.sqlFormatter.format(arg); return { sql: result.formattedSql, params: result.params }; } visit(arg) { return this.format(arg); } } exports.Formatter = Formatter; //# sourceMappingURL=Formatter.js.map